Panoramica
Le seguenti funzioni matematiche possono essere applicate a scalari e vettori. Se applicato ai vettori, il valore restituito è un vettore della funzione applicata a ciascuna voce dell'input.
 Ad esempio:
float3 a, b;
// The following call sets
//   a.x to sin(b.x),
//   a.y to sin(b.y), and
//   a.z to sin(b.z).
a = sin(b);
Consulta Funzioni matematiche vettoriali per funzioni come distance() e length() che interpretano invece l'input come un singolo vettore in uno spazio n-dimensionale.
La precisione delle operazioni matematiche su valori in virgola mobile a 32 bit è influenzata dai pragmas rs_fp_relaxed e rs_fp_full. Sotto rs_fp_relaxed, i valori subnormali possono essere cancellati a zero e potrebbe essere eseguito l'arrotondamento verso zero. In confronto, rs_fp_full richiede la gestione corretta dei valori subnormali, ovvero inferiori a 1,17549435e-38f. rs_fp_rull richiede anche arrotondamento più prossimo con parità.
Utilizzando le varianti delle comuni funzioni matematiche, è possibile ottenere diversi compromessi in termini di precisione/velocità. Funzioni con un nome che inizia con
- native_: potrebbero avere implementazioni hardware personalizzate con una precisione più debole. Inoltre, i valori subnormali possono essere cancellati a zero, potrebbe essere utilizzato l'arrotondamento verso lo zero e l'input NAN e infinito potrebbe non essere gestito correttamente.
- half_: può eseguire calcoli interni utilizzando valori in virgola mobile a 16 bit. Inoltre, i valori subnormali possono essere rimossi a zero ed è possibile utilizzare l'arrotondamento verso lo zero.
Riepilogo
| Costanti | |
|---|---|
| M_1_PI | 1 / pi, come float a 32 bit | 
| M_2_PI | 2 / pi, come float a 32 bit | 
| M_2_SQRTPI | 2 / sqrt(pi), come valore in virgola mobile a 32 bit | 
| L_E | e, come valore in virgola mobile a 32 bit | 
| LN10 | log_e(10), come valore in virgola mobile a 32 bit | 
| LN2 | log_e(2), come valore in virgola mobile a 32 bit | 
| M_LOG10E | log_10(e), come valore in virgola mobile a 32 bit | 
| M_LOG2E | log_2(e), come valore in virgola mobile a 32 bit | 
| M_PI | pi greco, come valore in virgola mobile a 32 bit | 
| M_PI_2 | pi / 2, come float a 32 bit | 
| M_PI_4 | pi greco / 4, come valore in virgola mobile a 32 bit | 
| M_SQRT1_2 | 1 / sqrt(2), come valore in virgola mobile a 32 bit | 
| RADQ2 | radice quadrata(2), come valore in virgola mobile a 32 bit | 
| Funzioni | |
|---|---|
| addominali | Valore assoluto di un numero intero | 
| acos | Coseno inverso | 
| acosh | Coseno iperbolico inverso | 
| acospi | Coseno inverso diviso per pi greco | 
| asin | Seno inverso | 
| asinh | Seno iperbolico inverso | 
| Asinpi | Seno inverso diviso per pi greco | 
| atan | Tangente inversa | 
| atan2 | Tangente inversa di un rapporto | 
| atan2pi | Tangente inversa di un rapporto, divisa per pi greco | 
| Alba | Tangente iperbolica inversa | 
| atanpi | Tangente inversa divisa per pi greco | 
| Radice cubica | |
| ceil | Numero intero più piccolo non inferiore a un valore | 
| pinza | Limitare un valore a un intervallo | 
| clz | Numero di 0 bit iniziali | 
| copysign | Copia il segno di un numero su un altro | 
| cos | Coseno | 
| baco | Coseno iperbolico | 
| Cospi | Coseno di un numero moltiplicato per pi greco | 
| gradi | Converte i radianti in gradi | 
| Funzione di errore matematico | |
| erfc | Funzione di errore complementare matematica | 
| exp | e elevato a un numero | 
| esp10 | 10 elevato a un numero | 
| esp2 | 2 elevato a un numero | 
| expm1 | e elevato a un numero meno uno | 
| fab | Valore assoluto di un numero in virgola mobile | 
| FIDIM | Differenza positiva tra due valori | 
| piano | Il numero intero più piccolo non è maggiore di un valore | 
| fma | Moltiplica e aggiungi | 
| Massimo due valori in virgola mobile | |
| fmin | Minimo due float | 
| fmod | Modulo | 
| fratta | Parte frazionata positiva | 
| Frexp | Mantissa binaria ed esponente | 
| ricevimento_metallo | Reciproca calcolata con precisione a 16 bit | 
| half_rsqrt | Reciproco di una radice quadrata calcolata con una precisione a 16 bit | 
| metà_mq | Radice quadrata calcolata con una precisione a 16 bit | 
| ipot | Ipotenusa | 
| ilogb | Esponente in base a due | 
| ldexp | Crea una virgola mobile da mantissa ed esponente | 
| lgamma | Logaritmo naturale della funzione gamma | 
| log | Logaritmo naturale | 
| log10 | Logaritmo in base 10 | 
| log1p | Logaritmo naturale di un valore più 1 | 
| log2 | Logaritmo in base 2 | 
| log | Esponente in base a due | 
| pazzo | Moltiplica e aggiungi | 
| massimo | Massima | 
| min | Minima | 
| mix | Combina due valori | 
| modf | Componenti integrali e frazionarie | 
| non disponibile | Non è un numero | 
| metà_nana | Non è un numero | 
| acos_nativi | Coseno inverso approssimativo | 
| acosh_nativo | Coseno iperbolico inverso approssimativo | 
| acospi_nativo | Coseno inverso approssimativo diviso per pi greco | 
| nativo_asin | Seno inverso approssimativo | 
| nativo_asinh | Seno iperbolico inverso approssimativo | 
| native_asinpi | Seno inverso approssimativo diviso pi greco | 
| nativo_atan | Tangente inversa approssimativa | 
| native_atan2 | Tangente inversa approssimativa di un rapporto | 
| native_atan2pi | Tangente inversa approssimativa di un rapporto, divisa per pi greco | 
| natanh_nativa | Tangente iperbolica inversa approssimativa | 
| atanpi_nativo | Tangente inversa approssimativa divisa per pi greco | 
| crt_nativo | Radice cubica approssimativa | 
| native_cos | Coseno approssimativo | 
| native_cosh | Coseno ipebolico approssimativo | 
| native_cospi | Coseno approssimativo di un numero moltiplicato per pi greco | 
| divisione_nativa | Divisione approssimativa | 
| esp_nativa | Valore approssimativo aumentato a un numero | 
| esperimento_nativo10 | Circa 10 elevato a un numero | 
| espressione_nativa2 | Circa 2 elevato a un numero | 
| expm1_nativo | Valore approssimativo aumentato a un numero meno uno | 
| hypot_nativo | Ipotenusa approssimativa | 
| native_log | Logaritmo naturale approssimativo | 
| native_log10 | Logaritmo approssimativo in base 10 | 
| native_log1p | Logaritmo naturale approssimativo di un valore più 1 | 
| native_log2 | Logaritmo approssimativo in base 2 | 
| powr_nativo | Base positiva approssimativa elevata a un esponente | 
| recip_nativo | Reciproco approssimativo | 
| native_rootn | Radice n-esima approssimativa | 
| [native_rsqrt] | Reciproco approssimativo di una radice quadrata | 
| nativo_sin | Seno approssimativo | 
| sincos_nativi | Seno e coseno approssimativi | 
| native_sinh | Seno iperbolico approssimativo | 
| sinpi_nativo | Seno approssimativo di un numero moltiplicato per pi greco | 
| [native_sqrt] | Radice quadrata approssimativa | 
| tan_nativo | Tangente approssimativa | 
| [native_tanh] | Tangente iperbolica approssimativa | 
| tanpi_nativo | Tangente approssimativa di un numero moltiplicata per pi greco | 
| nextafter | Numero in virgola mobile successivo | 
| papaya | Base elevata a un esponente | 
| marrone | Base elevata a un esponente intero | 
| powr | Base positiva elevata a un esponente | 
| radianti | Converte i gradi in radianti | 
| resto | Resti di una divisione | 
| remquo | Resto e quoziente di una divisione | 
| rint | Arrotonda a pari | 
| rootn | Radice n-esima | 
| rotondo | Arrotondamento lontano da zero | 
| rsRand | Numero pseudo-casuale | 
| Reciproco di una radice quadrata | |
| segno | Segno di un valore | 
| peccato | Seno | 
| Sincos | Seno e coseno | 
| senno | Seno iperbolico | 
| Seno di un numero moltiplicato per pi greco | |
| mq | Radice quadrata | 
| passaggio | 0 se è minore di un valore, 1 in caso contrario | 
| marrone chiaro | Tangente | 
| tanh | Tangente iperbolica | 
| tanpi | Tangente di un numero moltiplicato per pi greco | 
| Tgamma | Funzione gamma | 
| tronco | Tronca una rappresentazione in virgola mobile | 
| Funzioni deprecate | |
|---|---|
| Cavo | Obsoleta. Limitare un valore a un intervallo | 
| rsFrac | Obsoleta. Restituisce la parte frazionata di un float | 
Costanti
M_1_PI : 1 / pi, come valore in virgola mobile a 32 bit
| Valore: 0,318309886183790671537767526745028724f | 
L'inverso di pi greco, espresso in virgola mobile a 32 bit.
M_2_PI : 2 / pi, come valore in virgola mobile a 32 bit
| Valore: 0,636619772367581343075535053490057448f | 
2 diviso per pi greco, come valore in virgola mobile a 32 bit.
M_2_SQRTPI : 2 / sqrt(pi), come valore in virgola mobile a 32 bit
| Valore: 1.128379167095512573896158903121545172f | 
2 diviso per la radice quadrata di pi greco, come valore in virgola mobile a 32 bit.
M_E : e, come valore in virgola mobile a 32 bit
| Valore: 2.718281828459045235360287471352662498f | 
Il numero e, la base del logaritmo naturale, sotto forma di numero in virgola mobile a 32 bit.
M_LN10 : log_e(10), come valore in virgola mobile a 32 bit
| Valore: 2.302585092994045684017991454684364208f | 
Il logaritmo naturale di 10, come valore in virgola mobile a 32 bit.
M_LN2 : log_e(2), come valore in virgola mobile a 32 bit
| Valore: 0,693147180559945309417232121458176568f | 
Il logaritmo naturale di 2, come valore in virgola mobile a 32 bit.
M_LOG10E : log_10(e), come valore in virgola mobile a 32 bit
| Valore: 0,434294481903251827651128918916605082f | 
La base logaritmica 10 di e, sotto forma di numero in virgola mobile a 32 bit.
M_LOG2E : log_2(e), come valore in virgola mobile a 32 bit
| Valore: 1.442695040888963407359924681001892137f | 
La base logaritmica 2 di e, sotto forma di numero in virgola mobile a 32 bit.
M_PI : pi greco, come valore in virgola mobile a 32 bit
| Valore: 3.141592653589793238462643383279502884f | 
Il pi costante, espresso in virgola mobile a 32 bit.
M_PI_2 : pi / 2, come valore in virgola mobile a 32 bit
| Valore: 1.570796326794896619231321691639751442f | 
Pi diviso per 2, equivalente a un valore in virgola mobile a 32 bit.
M_PI_4 : pi / 4, come valore in virgola mobile a 32 bit
| Valore: 0,785398163397448309615660845819875721f | 
Pi diviso per 4, come valore in virgola mobile a 32 bit.
M_SQRT1_2 : 1 / sqrt(2), come valore in virgola mobile a 32 bit
| Valore: 0.707106781186547524400844362104849039f | 
L'inversa della radice quadrata di 2, espressa come un numero in virgola mobile a 32 bit.
M_SQRT2 : radice quadrata(2), come valore in virgola mobile a 32 bit
| Valore: 1.414213562373095048801688724209698079f | 
La radice quadrata di 2, espressa come valore in virgola mobile a 32 bit.
Funzioni
ass : valore assoluto di un numero intero
| uchar BS(char v); | |
| uchar2 BS(char2 v); | |
| uchar3 BS(char3 v); | |
| uchar4 BS(char4 v); | |
| uint asses(int v); | |
| uint2 abs(int2 v); | |
| uint3 abs(int3 v); | |
| uint4 abs(int4 v); | |
| ushort abs(short v); | |
| ushort2 abs(short2 v); | |
| ushort3 asses(short3 v); | |
| ushort4 abs(short4 v); | 
Restituisce il valore assoluto di un numero intero.
Per i numeri in virgola mobile, utilizza fab().
acos : coseno inverso
| float acos(float v); | |
| float2 acos(float2 v); | |
| float3 acos(float3 v); | |
| float4 acos(float4 v); | |
| half acos(half v); | Aggiunto al livello API 24 | 
| half2 acos(half2 v); | Aggiunto al livello API 24 | 
| half3 acos(half3 v); | Aggiunto al livello API 24 | 
| half4 acos(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno inverso, espresso in radianti.
Vedi anche la funzione native_acos().
acosh : coseno iperbolico inverso
| float acosh(float v); | |
| float2 acosh(float2 v); | |
| float3 acosh(float3 v); | |
| float4 acosh(float4 v); | |
| half acosh(half v); | Aggiunto al livello API 24 | 
| half2 acosh(half2 v); | Aggiunto al livello API 24 | 
| half3 acosh(half3 v); | Aggiunto al livello API 24 | 
| half4 acosh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno iperbolico inverso espresso in radianti.
Vedi anche la funzione native_acosh().
acospi : coseno inverso diviso per pi greco
| float acospi(float v); | |
| float2 acospi(float2 v); | |
| float3 acospi(float3 v); | |
| float4 acospi(float4 v); | |
| half acospi(half v); | Aggiunto al livello API 24 | 
| half2 acospi(half2 v); | Aggiunto al livello API 24 | 
| half3 acospi(half3 v); | Aggiunto al livello API 24 | 
| half4 acospi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno inverso in radianti, diviso per pi greco.
 Per ottenere un coseno inverso misurato in gradi, utilizza acospi(a) * 180.f.
Vedi anche la funzione native_acospi().
asin : seno inverso
| float asin(float v); | |
| float2 asin(float2 v); | |
| float3 asin(float3 v); | |
| float4 asin(float4 v); | |
| half asin(metà v); | Aggiunto al livello API 24 | 
| half2 asin(half2 v); | Aggiunto al livello API 24 | 
| half3 asin(half3 v); | Aggiunto al livello API 24 | 
| half4 asin(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno inverso, espresso in radianti.
Vedi anche la funzione native_asin().
asinh : seno iperbolico inverso
| float asinh(float v); | |
| float2 asinh(float2 v); | |
| float3 asinh(float3 v); | |
| float4 asinh(float4 v); | |
| half asinh(half v); | Aggiunto al livello API 24 | 
| half2 asinh(half2 v); | Aggiunto al livello API 24 | 
| half3 asinh(half3 v); | Aggiunto al livello API 24 | 
| half4 asinh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno iperbolico inverso, espresso in radianti.
Vedi anche native_asinh().
asinpi : seno inverso diviso per pi greco
| float asinpi(float v); | |
| float2 asinpi(float2 v); | |
| float3 asinpi(float3 v); | |
| float4 asinpi(float4 v); | |
| half asinpi(half v); | Aggiunto al livello API 24 | 
| half2 asinpi(half2 v); | Aggiunto al livello API 24 | 
| half3 asinpi(half3 v); | Aggiunto al livello API 24 | 
| half4 asinpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno inverso in radianti, diviso per pi greco.
 Per ottenere un seno inverso misurato in gradi, utilizza asinpi(a) * 180.f.
Vedi anche native_asinpi().
atan : tangente inversa
| float atan(float v); | |
| float2 atan(float2 v); | |
| float3 atan(float3 v); | |
| float4 atan(float4 v); | |
| half atan(half v); | Aggiunto al livello API 24 | 
| half2 atan(half2 v); | Aggiunto al livello API 24 | 
| half3 atan(half3 v); | Aggiunto al livello API 24 | 
| half4 atan(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente inversa, espressa in radianti.
Vedi anche la funzione native_atan().
atan2 : tangente inversa di un rapporto
| float atan2(numeratore in virgola mobile, denominatore in virgola mobile); | |
| float2 atan2(numeratore float2, denominatore float2); | |
| float3 atan2(numeratore float3, denominatore float3); | |
| float4 atan2(numeratore float4, denominatore float4); | |
| half atan2(metà numeratore, metà denominatore); | Aggiunto al livello API 24 | 
| half2 atan2(half2 numeratore, half2 denominatore); | Aggiunto al livello API 24 | 
| half3 atan2(half3 numeratore, half3 denominatore); | Aggiunto al livello API 24 | 
| half4 atan2(half4 numeratore, half4 denominatore); | Aggiunto al livello API 24 | 
Parametri
| numeratore | Numeratore. | 
|---|---|
| denominatore | Denominatore. Può essere 0. | 
 Restituisce la tangente inversa di (numerator / denominator), espressa in radianti.
Vedi anche native_atan2().
atan2pi : tangente inversa di un rapporto, divisa per pi greco
| float atan2pi(numeratore in virgola mobile, denominatore in virgola mobile); | |
| float2 atan2pi(numeratore float2, denominatore float2); | |
| float3 atan2pi(numeratore float3, denominatore float3); | |
| float4 atan2pi(numeratore float4, denominatore float4); | |
| half atan2pi(metà numeratore, metà denominatore); | Aggiunto al livello API 24 | 
| half2 atan2pi(half2 numeratore, half2 denominatore); | Aggiunto al livello API 24 | 
| half3 atan2pi(half3 numeratore, half3 denominatore); | Aggiunto al livello API 24 | 
| half4 atan2pi(half4 numeratore, half4 denominatore); | Aggiunto al livello API 24 | 
Parametri
| numeratore | Numeratore. | 
|---|---|
| denominatore | Denominatore. Può essere 0. | 
 Restituisce la tangente inversa di (numerator / denominator), espressa in radianti, divisa per pi greco.
 Per ottenere una tangente inversa misurata in gradi, utilizza atan2pi(n, d) * 180.f.
Vedi anche native_atan2pi().
atanh : tangente iperbolica inversa
| float atanh(float v); | |
| float2 atanh(float2 v); | |
| float3 atanh(float3 v); | |
| float4 atanh(float4 v); | |
| half atanh(half v); | Aggiunto al livello API 24 | 
| half2 atanh(half2 v); | Aggiunto al livello API 24 | 
| half3 atanh(half3 v); | Aggiunto al livello API 24 | 
| half4 atanh(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente iperbolica inversa espressa in radianti.
Vedi anche native_atanh().
atanpi : tangente inversa divisa per pi greco
| float atanpi(float v); | |
| float2 atanpi(float2 v); | |
| float3 atanpi(float3 v); | |
| float4 atanpi(float4 v); | |
| half atanpi(half v); | Aggiunto al livello API 24 | 
| half2 atanpi(half2 v); | Aggiunto al livello API 24 | 
| half3 atanpi(half3 v); | Aggiunto al livello API 24 | 
| half4 atanpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente inversa in radianti, divisa per pi greco.
 Per ottenere una tangente inversa misurata in gradi, utilizza atanpi(a) * 180.f.
Vedi anche la funzione native_atanpi().
cbrt : radice cubica
| float cbrt(float v); | |
| float2 cbrt(float2 v); | |
| float3 cbrt(float3 v); | |
| float4 cbrt(float4 v); | |
| half cbrt(half v); | Aggiunto al livello API 24 | 
| half2 cbrt(half2 v); | Aggiunto al livello API 24 | 
| half3 cbrt(half3 v); | Aggiunto al livello API 24 | 
| half4 cbrt(half4 v); | Aggiunto al livello API 24 | 
Restituisce la radice cubica.
Vedi anche la funzione native_cbrt().
ceil : il numero intero più piccolo non inferiore a un valore
| float ceil(float v); | |
| float2 ceil(float2 v); | |
| float3 ceil(float3 v); | |
| float4 ceil(float4 v); | |
| half ceil(half v); | Aggiunto al livello API 24 | 
| half2 ceil(half2 v); | Aggiunto al livello API 24 | 
| half3 ceil(half3 v); | Aggiunto al livello API 24 | 
| half4 ceil(half4 v); | Aggiunto al livello API 24 | 
Restituisce il numero intero più piccolo non inferiore a un valore.
 Ad esempio, ceil(1.2f) restituisce 2.f, mentre ceil(-1.2f) restituisce -1.f.
Vedi anche floor().
clamp : limita un valore a un intervallo
| char clamp(valore carattere, valore_min. caratteri, valore_max caratteri); | Aggiunto al livello API 19 | 
| char2 clamp(valore char2, valore_min char, valore_max caratteri); | Aggiunto al livello API 19 | 
| char2 clamp(valore char2, valore_min char2, valore_max char2); | Aggiunto al livello API 19 | 
| char3 clamp(valore char3, valore_min char, valore_max caratteri); | Aggiunto al livello API 19 | 
| char3 clamp(valore char3, valore_min char3, valore_max char3); | Aggiunto al livello API 19 | 
| char4 clamp(valore char4, valore_min_char, valore_max caratteri); | Aggiunto al livello API 19 | 
| char4 clamp(valore char4, valore_min char4, valore_max char4); | Aggiunto al livello API 19 | 
| clamp float(valore in virgola mobile, valore_min in virgola mobile, valore_max in virgola mobile); | |
| clamp float2(valore float2, valore_minimo float, valore_max in virgola mobile); | |
| clamp float2(valore float2, valore_min float2, valore_max float2; | |
| clamp float3(valore float3, valore_minimo float, valore_max in virgola mobile); | |
| clamp float3(valore float3, valore_min float3, valore_max float3; | |
| clamp float4(valore float4, valore_min in virgola mobile, valore_max in virgola mobile); | |
| clamp float4(valore float4, valore_min float4, valore_max float4); | |
| half clamp(metà valore, metà valore_min, mezza valore_max); | Aggiunto al livello API 24 | 
| half2 clamp(half2 value, half min_value, half max_value); | Aggiunto al livello API 24 | 
| half2 clamp(half2 value, half2 min_value, half2 max_value); | Aggiunto al livello API 24 | 
| half3 clamp(half3 value, half min_value, half max_value); | Aggiunto al livello API 24 | 
| half3 clamp(half3 value, half3 min_value, half3 max_value); | Aggiunto al livello API 24 | 
| half4 clamp(half4 value, half min_value, half max_value); | Aggiunto al livello API 24 | 
| half4 clamp(half4 value, half4 min_value, half4 max_value); | Aggiunto al livello API 24 | 
| int clamp(valore int, valore_min int, valore_max int); | Aggiunto al livello API 19 | 
| int2 clamp(valore int2, valore_min int, valore_max int); | Aggiunto al livello API 19 | 
| int2 clamp(valore int2, valore_min int2, valore_max int2); | Aggiunto al livello API 19 | 
| int3 clamp(valore int3, valore_min int, valore_max int); | Aggiunto al livello API 19 | 
| int3 clamp(valore int3, valore_min int3, valore_max int3); | Aggiunto al livello API 19 | 
| int4 clamp(valore int4, valore_min int, valore_max int); | Aggiunto al livello API 19 | 
| int4 clamp(valore int4, valore_min int4, valore_max int4); | Aggiunto al livello API 19 | 
| long clamp(valore lungo, valore_min lungo, valore_max lungo); | Aggiunto al livello API 19 | 
| long2 clamp(valore long2, valore_min lungo, valore_max lungo); | Aggiunto al livello API 19 | 
| long2 clamp(valore long2, valore_min long2, valore_max long2); | Aggiunto al livello API 19 | 
| clamp long3(valore long3, valore_min lungo, valore_max lungo); | Aggiunto al livello API 19 | 
| long3 clamp(valore long3, valore_min long3, valore_max long3); | Aggiunto al livello API 19 | 
| long4 clamp(valore long4, valore_min lungo, valore_max lungo); | Aggiunto al livello API 19 | 
| long4 clamp(valore long4, valore_min long4, valore_max long4); | Aggiunto al livello API 19 | 
| pinza corta(valore breve, valore_min breve, valore_max breve); | Aggiunto al livello API 19 | 
| short2 clamp(valore short2, valore_min_corto, valore_max breve); | Aggiunto al livello API 19 | 
| short2 clamp(valore short2, valore_minimo short2, valore_max short2); | Aggiunto al livello API 19 | 
| short3 clamp(valore short3, valore_min_corto, valore_max breve); | Aggiunto al livello API 19 | 
| short3 clamp(valore short3, valore_minimo short3, valore_max short3); | Aggiunto al livello API 19 | 
| short4 clamp(valore short4, valore_min_corto, valore_max breve); | Aggiunto al livello API 19 | 
| short4 clamp(valore short4, valore_minimo short4, valore_max short4); | Aggiunto al livello API 19 | 
| uchar clamp(valore uchar, valore_min uchar, valore_max uchar); | Aggiunto al livello API 19 | 
| uchar2 clamp(valore uchar2, valore min_uchar, valore max_uchar); | Aggiunto al livello API 19 | 
| uchar2 clamp(valore uchar2, valore_min uchar2, valore_max uchar2); | Aggiunto al livello API 19 | 
| uchar3 clamp(valore uchar3, valore_min_uchar, valore_max uchar); | Aggiunto al livello API 19 | 
| uchar3 clamp(valore uchar3, valore_min uchar3, valore_max uchar3); | Aggiunto al livello API 19 | 
| uchar4 clamp(valore uchar4, valore_min_uchar, valore_max uchar); | Aggiunto al livello API 19 | 
| clamp uchar4(valore uchar4, valore_min uchar4, valore_max uchar4); | Aggiunto al livello API 19 | 
| uint clamp(valore uint, valore_min uint, valore_max uint); | Aggiunto al livello API 19 | 
| uint2 clamp(valore uint2, valore_min uint, valore_max uint); | Aggiunto al livello API 19 | 
| uint2 clamp(valore uint2, valore_min uint2, valore_max uint2); | Aggiunto al livello API 19 | 
| uint3 clamp(valore uint3, valore_min uint, valore_max uint); | Aggiunto al livello API 19 | 
| uint3 clamp(valore uint3, valore_min uint3, valore_max uint3); | Aggiunto al livello API 19 | 
| uint4 clamp(valore uint4, valore_min uint, valore_max uint); | Aggiunto al livello API 19 | 
| uint4 clamp(valore uint4, valore_min uint4, valore_max uint4); | Aggiunto al livello API 19 | 
| ulong clamp(valore ulong, valore_min_ulong, valore_max ulong); | Aggiunto al livello API 19 | 
| ulong2 clamp(valore ulong2, valore_min ulong, valore_max ulong); | Aggiunto al livello API 19 | 
| ulong2 clamp(valore ulong2, valore_min ulong2, valore_max ulong2); | Aggiunto al livello API 19 | 
| ulong3 clamp(valore ulong3, valore_min_ulong, valore_max ulong); | Aggiunto al livello API 19 | 
| ulong3 clamp(valore ulong3, valore_min ulong3, valore_max ulong3); | Aggiunto al livello API 19 | 
| ulong4 clamp(valore ulong4, valore_min_ulong, valore_max ulong); | Aggiunto al livello API 19 | 
| ulong4 clamp(valore ulong4, valore_min ulong4, valore_max ulong4); | Aggiunto al livello API 19 | 
| clamp ushort(valore ushort, valore_min_ushort, valore_max ushort); | Aggiunto al livello API 19 | 
| clamp ushort2(valore ushort2, valore min_ushort, valore_max ushort); | Aggiunto al livello API 19 | 
| clamp ushort2(valore ushort2, valore_minimo ushort2, valore_max ushort2); | Aggiunto al livello API 19 | 
| ushort3 clamp(valore ushort3, valore_minimo ushort, valore_max ushort); | Aggiunto al livello API 19 | 
| ushort3 clamp(valore ushort3, ushort3 min_value, ushort3 max_value); | Aggiunto al livello API 19 | 
| clamp ushort4(valore ushort4, valore_minimo ushort, valore_max ushort); | Aggiunto al livello API 19 | 
| clamp ushort4(valore ushort4, valore_minimo ushort4, valore_max ushort4); | Aggiunto al livello API 19 | 
Parametri
| value | Valore da fissare. | 
|---|---|
| valore_min | Limite inferiore, un vettore scalare o corrispondente. | 
| valore_max | Limite alto, deve corrispondere al tipo di limite basso. | 
Associa un valore a un limite alto e basso specificato. clamp() restituisce min_value se value < min_value, max_value se value > max_value, altrimenti value.
Esistono due varianti di clamp: una in cui min e max sono scalari applicati a tutte le voci del valore, l'altra in cui min e max sono anch'essi vettori.
Se min_value è maggiore di max_value, i risultati non sono definiti.
clz : numero di 0 bit iniziali
| char clz(char value); | |
| char2 clz(valore char2); | |
| char3 clz(valore char3); | |
| char4 clz(valore char4); | |
| int clz(int value); | |
| int2 clz(valore int2); | |
| int3 clz(valore int3); | |
| int4 clz(valore int4); | |
| clz breve(valore breve); | |
| short2 clz(valore short2); | |
| short3 clz(valore short3); | |
| short4 clz(valore short4); | |
| uchar clz(valore uchar); | |
| uchar2 clz(valore uchar2); | |
| uchar3 clz(valore uchar3); | |
| uchar4 clz(valore uchar4); | |
| uint clz(valore uint); | |
| uint2 clz(valore uint2); | |
| uint3 clz(valore uint3); | |
| uint4 clz(valore uint4); | |
| ushort clz(valore ushort); | |
| ushort2 clz(valore ushort2); | |
| ushort3 clz(valore ushort3); | |
| ushort4 clz(valore ushort4); | 
Restituisce il numero di 0 bit iniziali in un valore.
 Ad esempio, clz((char)0x03) restituisce 6.
copysign : copia il segno di un numero su un altro
| float copysign(float magnitude_value, float sign_value); | |
| float2 copysign(float2 magnitude_value, float2 sign_value); | |
| float3 copysign(float3 magnitude_value, float3 sign_value); | |
| float4 copysign(float4 magnitude_value, float4 sign_value); | |
| half copysign(mezza magnitude_value, mezza sign_value); | Aggiunto al livello API 24 | 
| half2 copysign(half2 magnitude_value, half2 sign_value); | Aggiunto al livello API 24 | 
| half3 copysign(half3 magnitude_value, half3 sign_value); | Aggiunto al livello API 24 | 
| half4 copysign(half4 magnitude_value, half4 sign_value); | Aggiunto al livello API 24 | 
Copia il segno da sign_value a magnitude_value.
Il valore restituito è magnitude_value o -magnitude_value.
 Ad esempio, copysign(4.0f, -2.7f) restituisce -4.0f e copysign(-4.0f, 2.7f) restituisce 4.0f.
cos : coseno
| float cos(float v); | |
| float2 cos(float2 v); | |
| float3 cos(float3 v); | |
| float4 cos(float4 v); | |
| half cos(half v); | Aggiunto al livello API 24 | 
| half2 cos(half2 v); | Aggiunto al livello API 24 | 
| half3 cos(half3 v); | Aggiunto al livello API 24 | 
| half4 cos(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno di un angolo misurato in radianti.
Vedi anche la funzione native_cos().
cosh : coseno iperbolico
| float cosh(float v); | |
| float2 cosh(float2 v); | |
| float3 cosh(float3 v); | |
| float4 cosh(float4 v); | |
| half cosh(half v); | Aggiunto al livello API 24 | 
| half2 cosh(half2 v); | Aggiunto al livello API 24 | 
| half3 cosh(half3 v); | Aggiunto al livello API 24 | 
| half4 cosh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno ipebolico di v, dove v è misurato in radianti.
Vedi anche la funzione native_cosh().
cospi : coseno di un numero moltiplicato per pi greco
| float cospi(float v); | |
| float2 cospi(float2 v); | |
| float3 cospi(float3 v); | |
| float4 cospi(float4 v); | |
| half cospi(half v); | Aggiunto al livello API 24 | 
| half2 cospi(half2 v); | Aggiunto al livello API 24 | 
| half3 cospi(half3 v); | Aggiunto al livello API 24 | 
| half4 cospi(half4 v); | Aggiunto al livello API 24 | 
 Restituisce il coseno di (v * pi), dove (v * pi) è misurato in radianti.
 Per ottenere il coseno di un valore misurato in gradi, chiama cospi(v / 180.f).
Vedi anche native_cospi().
gradi : converte i radianti in gradi
| gradi in virgola mobile(float v); | |
| float2 gradi(float2 v); | |
| float3 gradi(float3 v); | |
| float4 gradi(float4 v); | |
| mezzo gradi(metà v); | Aggiunto al livello API 24 | 
| half2 gradi(half2 v); | Aggiunto al livello API 24 | 
| half3 gradi(half3 v); | Aggiunto al livello API 24 | 
| half4 gradi(half4 v); | Aggiunto al livello API 24 | 
Converte da radianti a gradi.
erf : funzione di errore matematico
| float erf(float v); | |
| float2 erf(float2 v); | |
| float3 erf(float3 v); | |
| float4 erf(float4 v); | |
| half erf(half v); | Aggiunto al livello API 24 | 
| half2 erf(half2 v); | Aggiunto al livello API 24 | 
| half3 erf(half3 v); | Aggiunto al livello API 24 | 
| half4 erf(half4 v); | Aggiunto al livello API 24 | 
Restituisce la funzione di errore.
erfc : Funzione di errore complementare matematica
| float erfc(float v); | |
| float2 erfc(float2 v); | |
| float3 erfc(float3 v); | |
| float4 erfc(float4 v); | |
| half erfc(half v); | Aggiunto al livello API 24 | 
| half2 erfc(half2 v); | Aggiunto al livello API 24 | 
| half3 erfc(half3 v); | Aggiunto al livello API 24 | 
| half4 erfc(half4 v); | Aggiunto al livello API 24 | 
Restituisce la funzione di errore complementare.
exp : e elevato a un numero
| exp in virgola mobile(float v); | |
| float2 exp(float2 v); | |
| float3 exp(float3 v); | |
| float4 exp(float4 v); | |
| half exp(half v); | Aggiunto al livello API 24 | 
| half2 exp(half2 v); | Aggiunto al livello API 24 | 
| half3 exp(half3 v); | Aggiunto al livello API 24 | 
| half4 exp(half4 v); | Aggiunto al livello API 24 | 
Restituisce e elevato a v, ad esempio e ^ v.
Vedi anche native_exp().
exp10 : 10 elevato a un numero
| float exp10(float v); | |
| float2 exp10(float2 v); | |
| float3 exp10(float3 v); | |
| float4 exp10(float4 v); | |
| half exp10(metà v); | Aggiunto al livello API 24 | 
| half2 exp10(half2 v); | Aggiunto al livello API 24 | 
| half3 exp10(half3 v); | Aggiunto al livello API 24 | 
| half4 exp10(half4 v); | Aggiunto al livello API 24 | 
Restituisce 10 elevato a v, ad esempio 10.f ^ v.
Vedi anche native_exp10().
exp2 : 2 elevato a un numero
| float exp2(float v); | |
| float2 exp2(float2 v); | |
| float3 exp2(float3 v); | |
| float4 exp2(float4 v); | |
| half exp2(half v); | Aggiunto al livello API 24 | 
| half2 exp2(half2 v); | Aggiunto al livello API 24 | 
| half3 exp2(half3 v); | Aggiunto al livello API 24 | 
| half4 exp2(half4 v); | Aggiunto al livello API 24 | 
Restituisce 2 elevato a v, ad esempio 2.f ^ v.
Vedi anche native_exp2().
expm1 : e elevato a un numero meno uno
| float expm1(float v); | |
| float2 expm1(float2 v); | |
| float3 expm1(float3 v); | |
| float4 expm1(float4 v); | |
| half expm1(half v); | Aggiunto al livello API 24 | 
| half2 expm1(half2 v); | Aggiunto al livello API 24 | 
| half3 expm1(half3 v); | Aggiunto al livello API 24 | 
| half4 expm1(half4 v); | Aggiunto al livello API 24 | 
Restituisce e elevato a v meno 1, ovvero (e ^ v) - 1.
Vedi anche la funzione native_expm1().
fab : valore assoluto di un numero in virgola mobile
| float fabs(float v); | |
| float2 fabs(float2 v); | |
| float3 fabs(float3 v); | |
| float4 fabs(float4 v); | |
| half fabs(half v); | Aggiunto al livello API 24 | 
| half2 fabs(half2 v); | Aggiunto al livello API 24 | 
| half3 fabs(half3 v); | Aggiunto al livello API 24 | 
| half4 fabs(half4 v); | Aggiunto al livello API 24 | 
Restituisce il valore assoluto del valore in virgola mobile v.
Per i numeri interi, utilizza AB().
fdim : differenza positiva tra due valori
| float fdim(float a, float b); | |
| float2 fdim(float2 a, float2 b); | |
| float3 fdim(float3 a, float3 b); | |
| float4 fdim(float4 a, float4 b); | |
| half fdim(half a, half b); | Aggiunto al livello API 24 | 
| half2 fdim(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 fdim(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 fdim(half4 a, half4 b); | Aggiunto al livello API 24 | 
Restituisce la differenza positiva tra due valori.
Se a > b, restituisce (a - b), altrimenti restituisce 0f.
floor : il numero intero più piccolo non maggiore di un valore
| pavimento in virgola mobile(float v); | |
| float2 piano(float2 v); | |
| float3 Floor(float3 v); | |
| float4 Floor(float4 v); | |
| mezza piano(metà v); | Aggiunto al livello API 24 | 
| half2 plan(half2 v); | Aggiunto al livello API 24 | 
| half3 piano(half3 v); | Aggiunto al livello API 24 | 
| half4 piano(half4 v); | Aggiunto al livello API 24 | 
Restituisce il numero intero più piccolo non superiore a un valore.
 Ad esempio, floor(1.2f) restituisce 1.f, mentre floor(-1.2f) restituisce -2.f.
Vedi anche ceil().
fma : moltiplica e aggiungi
| float fma(float moltiplicad1, float moltiplicad2, float offset); | |
| float2 fma(float2 moltiplicando1, float2 moltiplicando2, float2 offset); | |
| float3 fma(float3 moltiplicando1, float3 moltiplicando2, float3 offset); | |
| float4 fma(float4 moltiplicando1, float4 moltiplicando2, float4 offset); | |
| half fma(metà moltiplicando1, mezza moltiplicando2, mezza offset); | Aggiunto al livello API 24 | 
| half2 fma(half2 moltiplicando1, half2 moltiplicando2, half2 offset); | Aggiunto al livello API 24 | 
| half3 fma(half3 moltiplicando1, half3 moltiplicando2, half3 offset); | Aggiunto al livello API 24 | 
| half4 fma(half4 moltiplicando1, half4 moltiplicando2, half4 offset); | Aggiunto al livello API 24 | 
 Moltiplica e aggiungi.  Restituisce (multiplicand1 * multiplicand2) + offset.
Questa funzione è simile a mad(). fma() conserva la massima precisione del risultato moltiplicato e arrotonda solo dopo l'addizione. mad() arrotonda dopo la moltiplicazione e l'addizione. Questa precisione aggiuntiva non è garantita nella modalità rs_fp_relaxed.
fmax : massimo due valori in virgola mobile
| float fmax(float a, float b); | |
| float2 fmax(float2 a, float b); | |
| float2 fmax(float2 a, float2 b); | |
| float3 fmax(float3 a, float b); | |
| float3 fmax(float3 a, float3 b); | |
| float4 fmax(float4 a, float b); | |
| float4 fmax(float4 a, float4 b); | |
| half fmax(half a, half b); | Aggiunto al livello API 24 | 
| half2 fmax(half2 a, half b); | Aggiunto al livello API 24 | 
| half2 fmax(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 fmax(half3 a, half b); | Aggiunto al livello API 24 | 
| half3 fmax(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 fmax(half4 a, half b); | Aggiunto al livello API 24 | 
| half4 fmax(half4 a, half4 b); | Aggiunto al livello API 24 | 
 Restituisce il massimo di a e b, ad esempio (a < b ? b : a).
La funzione max() restituisce risultati identici, ma può essere applicata a più tipi di dati.
fmin : almeno due caratteri in virgola mobile
| float fmin(float a, float b); | |
| float2 fmin(float2 a, float b); | |
| float2 fmin(float2 a, float2 b); | |
| float3 fmin(float3 a, float b); | |
| float3 fmin(float3 a, float3 b); | |
| float4 fmin(float4 a, float b); | |
| float4 fmin(float4 a, float4 b); | |
| half fmin(half a, half b); | Aggiunto al livello API 24 | 
| half2 fmin(half2 a, half b); | Aggiunto al livello API 24 | 
| half2 fmin(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 fmin(half3 a, half b); | Aggiunto al livello API 24 | 
| half3 fmin(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 fmin(half4 a, half b); | Aggiunto al livello API 24 | 
| half4 fmin(half4 a, half4 b); | Aggiunto al livello API 24 | 
 Restituisce il minimo di a e b, ad esempio (a > b ? b : a).
La funzione min() restituisce risultati identici, ma può essere applicata a più tipi di dati.
fmod : Modulo
| fmod in virgola mobile(numeratore in virgola mobile, denominatore in virgola mobile); | |
| float2 fmod(numeratore float2, denominatore float2); | |
| float3 fmod(numeratore float3, denominatore float3); | |
| float4 fmod(numeratore float4, denominatore float4); | |
| half fmod(metà numeratore, metà denominatore); | Aggiunto al livello API 24 | 
| half2 fmod(half2 numeratore, half2 denominatore); | Aggiunto al livello API 24 | 
| half3 fmod(half3 numeratore, half3 denominatore); | Aggiunto al livello API 24 | 
| half4 fmod(half4 numeratore, half4 denominatore); | Aggiunto al livello API 24 | 
Restituisce il resto di (numeratore / denominatore), in cui il quoziente viene arrotondato a zero.
 La funzione remainder() è simile, ma arrotonda al numero intero più vicino.
Ad esempio, fmod(-3.8f, 2.f) restituisce -1.8f (-3.8f - -1.f * 2.f)
mentre remainder(-3.8f, 2.f) restituisce 0.2f (-3.8f - -2.f * 2.f).
fratta : parte frazionata positiva
| fract in virgola mobile(float v); | |
| fract in virgola mobile(float v, float* piano); | |
| float2 fract(float2 v); | |
| float2 fract(float2 v, float2* piano); | |
| float3 fract(float3 v); | |
| float3 fract(float3 v, float3* piano); | |
| float4 fract(float4 v); | |
| float4 fract(float4 v, float4* piano); | |
| half fract(half v); | Aggiunto al livello API 24 | 
| half fract(metà v, metà* piano); | Aggiunto al livello API 24 | 
| half2 fract(half2 v); | Aggiunto al livello API 24 | 
| half2 fract(half2 v, half2* piano); | Aggiunto al livello API 24 | 
| half3 fract(half3 v); | Aggiunto al livello API 24 | 
| half3 fract(metà3 v, mezza3* piano); | Aggiunto al livello API 24 | 
| half4 fract(half4 v); | Aggiunto al livello API 24 | 
| half4 fract(metà4 contro, mezza4* piano); | Aggiunto al livello API 24 | 
Parametri
| v | Valore di input. | 
|---|---|
| piano | Se il valore minimo non è null, *il piano verrà impostato sul valore minimo di v. | 
 Restituisce la parte frazionaria positiva di v, ad esempio v - floor(v).
 Ad esempio, fract(1.3f, &val) restituisce 0.3f e imposta val su 1.f.
fract(-1.3f, &val) restituisce 0.7f e imposta val su -2.f.
frexp : mantissa ed esponente binaria
| float frexp(float v, int* exponent); | |
| float2 frexp(float2 v, int2* esponente); | |
| float3 frexp(float3 v, int3* esponente); | |
| float4 frexp(float4 v, int4* esponente); | |
| half frexp(half v, int* exponente); | Aggiunto al livello API 24 | 
| half2 frexp(half2 v, int2* esponente); | Aggiunto al livello API 24 | 
| half3 frexp(half3 v, int3* esponente); | Aggiunto al livello API 24 | 
| half4 frexp(half4 v, int4* esponente); | Aggiunto al livello API 24 | 
Parametri
| v | Valore di input. | 
|---|---|
| esponente | Se l'esponente non è nullo, *esponente verrà impostato sull'esponente di v. | 
half_recip : reciproca calcolata con una precisione a 16 bit
| float half_recip(float v); | Aggiunto al livello API 17 | 
| float2 half_recip(float2 v); | Aggiunto al livello API 17 | 
| float3 half_recip(float3 v); | Aggiunto al livello API 17 | 
| float4 half_recip(float4 v); | Aggiunto al livello API 17 | 
Restituisce il reciproco approssimativo di un valore.
La precisione è quella di un valore in virgola mobile a 16 bit.
Vedi anche la funzione native_recip().
half_rsqrt : reciproca di una radice quadrata calcolata con una precisione a 16 bit
| float half_rsqrt(float v); | Aggiunto al livello API 17 | 
| float2 half_rsqrt(float2 v); | Aggiunto al livello API 17 | 
| float3 half_rsqrt(float3 v); | Aggiunto al livello API 17 | 
| float4 half_rsqrt(float4 v); | Aggiunto al livello API 17 | 
 Restituisce il valore approssimativo di (1.f / sqrt(value)).
La precisione è quella di un valore in virgola mobile a 16 bit.
Vedi anche rsqrt(), native_rsqrt().
half_sqrt : radice quadrata calcolata con una precisione a 16 bit
| float half_sqrt(float v); | Aggiunto al livello API 17 | 
| float2 half_sqrt(float2 v); | Aggiunto al livello API 17 | 
| float3 half_sqrt(float3 v); | Aggiunto al livello API 17 | 
| float4 half_sqrt(float4 v); | Aggiunto al livello API 17 | 
Restituisce la radice quadrata approssimativa di un valore.
La precisione è quella di un valore in virgola mobile a 16 bit.
Vedi anche sqrt(), native_sqrt().
hypot : ipotenusa
| float hypot(float a, float b); | |
| float2 hypot(float2 a, float2 b); | |
| float3 hypot(float3 a, float3 b); | |
| float4 hypot(float4 a, float4 b); | |
| half hypot(half a, half b); | Aggiunto al livello API 24 | 
| half2 hypot(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 hypot(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 hypot(half4 a, half4 b); | Aggiunto al livello API 24 | 
 Restituisce l'ipotenusa, ad esempio sqrt(a * a + b * b).
Vedi anche native_hypot().
ilogb : in base a due esponenti
| int ilogb(float v); | |
| int ilogb(half v); | Aggiunto al livello API 24 | 
| int2 ilogb(float2 v); | |
| int2 ilogb(half2 v); | Aggiunto al livello API 24 | 
| int3 ilogb(float3 v); | |
| int3 ilogb(half3 v); | Aggiunto al livello API 24 | 
| int4 ilogb(float4 v); | |
| int4 ilogb(half4 v); | Aggiunto al livello API 24 | 
Restituisce i due esponenti di base di un valore, dove la mantissa è compresa tra 1.f (incluso) e 2.f (escluso).
 Ad esempio, ilogb(8.5f) restituisce 3.
A causa della differenza in mantissa, questo numero è uno in meno di quello restituito da frexp().
logb() è simile ma restituisce un numero in virgola mobile.
ldexp : crea una virgola mobile da mantissa ed esponente
| float ldexp(float mantissa, int exponent); | |
| float2 ldexp(float2 mantissa, esponente int); | |
| float2 ldexp(float2 mantissa, int2 esponente); | |
| float3 ldexp(float3 mantissa, esponente int); | |
| float3 ldexp(float3 mantissa, int3 esponente); | |
| float4 ldexp(float4 mantissa, esponente int); | |
| float4 ldexp(float4 mantissa, int4 esponente); | |
| half ldexp(mezza mantissa, esponente int); | Aggiunto al livello API 24 | 
| half2 ldexp(half2 mantissa, int esponente); | Aggiunto al livello API 24 | 
| half2 ldexp(half2 mantissa, int2 esponente); | Aggiunto al livello API 24 | 
| half3 ldexp(half3 mantissa, int esponente); | Aggiunto al livello API 24 | 
| half3 ldexp(half3 mantissa, int3 esponente); | Aggiunto al livello API 24 | 
| half4 ldexp(half4 mantissa, int esponente); | Aggiunto al livello API 24 | 
| half4 ldexp(half4 mantissa, int4 esponente); | Aggiunto al livello API 24 | 
Parametri
| Mantissa | Mantissa. | 
|---|---|
| esponente | Esponente, un singolo componente o un vettore corrispondente. | 
Restituisce la virgola mobile creata dalla mantissa e dall'esponente, ad esempio (mantissa * 2 ^ esponente).
Vedi frexp() per l'operazione inversa.
lgamma : logaritmo naturale della funzione gamma
| float lgamma(float v); | |
| float lgamma(float v, int* sign_of_gamma); | |
| float2 lgamma(float2 v); | |
| float2 lgamma(float2 v, int2* sign_of_gamma); | |
| float3 lgamma(float3 v); | |
| float3 lgamma(float3 v, int3* sign_of_gamma); | |
| float4 lgamma(float4 v); | |
| float4 lgamma(float4 v, int4* sign_of_gamma); | |
| half lgamma(metà v); | Aggiunto al livello API 24 | 
| half lgamma(half v, int* sign_of_gamma); | Aggiunto al livello API 24 | 
| half2 lgamma(half2 v); | Aggiunto al livello API 24 | 
| half2 lgamma(half2 v, int2* sign_of_gamma); | Aggiunto al livello API 24 | 
| half3 lgamma(half3 v); | Aggiunto al livello API 24 | 
| half3 lgamma(half3 v, int3* sign_of_gamma); | Aggiunto al livello API 24 | 
| half4 lgamma(half4 v); | Aggiunto al livello API 24 | 
| half4 lgamma(half4 v, int4* sign_of_gamma); | Aggiunto al livello API 24 | 
Parametri
| v | |
|---|---|
| segno_di_gamma | Se segno_di_gamma non è nullo, *sign_of_gamma sarà impostato su -1.f se la gamma di v è negativa, altrimenti su 1.f. | 
log : logaritmo naturale
| log in virgola mobile(float v); | |
| float2 log(float2 v); | |
| float3 log(float3 v); | |
| float4 log(float4 v); | |
| half log(half v); | Aggiunto al livello API 24 | 
| half2 log(half2 v); | Aggiunto al livello API 24 | 
| half3 log(half3 v); | Aggiunto al livello API 24 | 
| half4 log(half4 v); | Aggiunto al livello API 24 | 
Restituisce il logaritmo naturale.
Vedi anche la funzione native_log().
log10 : logaritmo in base 10
| float log10(float v); | |
| float2 log10(float2 v); | |
| float3 log10(float3 v); | |
| float4 log10(float4 v); | |
| half log10(metà v); | Aggiunto al livello API 24 | 
| half2 log10(half2 v); | Aggiunto al livello API 24 | 
| half3 log10(half3 v); | Aggiunto al livello API 24 | 
| half4 log10(half4 v); | Aggiunto al livello API 24 | 
Restituisce il logaritmo in base 10.
Vedi anche la funzione native_log10().
log1p : logaritmo naturale di un valore più 1
| float log1p(float v); | |
| float2 log1p(float2 v); | |
| float3 log1p(float3 v); | |
| float4 log1p(float4 v); | |
| half log1p(half v); | Aggiunto al livello API 24 | 
| half2 log1p(half2 v); | Aggiunto al livello API 24 | 
| half3 log1p(half3 v); | Aggiunto al livello API 24 | 
| half4 log1p(half4 v); | Aggiunto al livello API 24 | 
 Restituisce il logaritmo naturale di (v + 1.f).
Vedi anche native_log1p().
log2 : logaritmo in base 2
| float log2(float v); | |
| float2 log2(float2 v); | |
| float3 log2(float3 v); | |
| float4 log2(float4 v); | |
| half log2(half v); | Aggiunto al livello API 24 | 
| half2 log2(half2 v); | Aggiunto al livello API 24 | 
| half3 log2(half3 v); | Aggiunto al livello API 24 | 
| half4 log2(half4 v); | Aggiunto al livello API 24 | 
Restituisce il logaritmo in base 2.
Vedi anche la funzione native_log2().
logb : in base a due esponenti
| float logb(float v); | |
| float2 logb(float2 v); | |
| float3 logb(float3 v); | |
| float4 logb(float4 v); | |
| half logb(half v); | Aggiunto al livello API 24 | 
| half2 logb(half2 v); | Aggiunto al livello API 24 | 
| half3 logb(half3 v); | Aggiunto al livello API 24 | 
| half4 logb(half4 v); | Aggiunto al livello API 24 | 
Restituisce i due esponenti di base di un valore, dove la mantissa è compresa tra 1.f (incluso) e 2.f (escluso).
 Ad esempio, logb(8.5f) restituisce 3.f.
A causa della differenza in mantissa, questo numero è uno in meno di quello restituito da frexp().
ilogb() è simile ma restituisce un numero intero.
mad : moltiplica e aggiungi
| float mad(float moltiplicando1, float moltiplicad2, float offset); | |
| float2 mad(float2 moltiplicacand1, float2 moltiplicacand2, float2 offset); | |
| float3 mad(float3 moltiplicacand1, float3 moltiplicacand2, float3 offset); | |
| float4 mad(float4 moltiplicando1, float4 moltiplicando2, float4 offset); | |
| half mad(metà moltiplicando1, metà moltiplicando2, mezza offset); | Aggiunto al livello API 24 | 
| half2 mad(half2 moltiplicando1, half2 moltiplicando2, half2 offset); | Aggiunto al livello API 24 | 
| half3 mad(half3 moltiplicando1, half3 moltiplicando2, half3 offset); | Aggiunto al livello API 24 | 
| half4 mad(half4 moltiplicando1, half4 moltiplicando2, half4 offset); | Aggiunto al livello API 24 | 
 Moltiplica e aggiungi.  Restituisce (multiplicand1 * multiplicand2) + offset.
Questa funzione è simile a fma(). fma() conserva la massima precisione del risultato moltiplicato e arrotonda solo dopo l'addizione. mad() arrotonda dopo la moltiplicazione e l'addizione. In modalità rs_fp_relaxed, mad() potrebbe non eseguire l'arrotondamento dopo il moltiplicazione.
max : valore massimo
| char max(char a, char b); | |
| char2 max(char2 a, char2 b); | |
| char3 max(char3 a, char3 b); | |
| char4 max(char4 a, char4 b); | |
| float max(float a, float b); | |
| float2 max(float2 a, float b); | |
| float2 max(float2 a, float2 b); | |
| float3 max(float3 a, float b); | |
| float3 max(float3 a, float3 b); | |
| float4 max(float4 a, float b); | |
| float4 max(float4 a, float4 b); | |
| half max(half a, half b); | Aggiunto al livello API 24 | 
| half2 max(half2 a, half b); | Aggiunto al livello API 24 | 
| half2 max(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 max(half3 a, half b); | Aggiunto al livello API 24 | 
| half3 max(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 max(half4 a, half b); | Aggiunto al livello API 24 | 
| half4 max(half4 a, half4 b); | Aggiunto al livello API 24 | 
| int max(int a, int b); | |
| int2 max(int2 a, int2 b); | |
| int3 max(int3 a, int3 b); | |
| int4 max(int4 a, int4 b); | |
| long max(long a, long b); | Aggiunto al livello API 21 | 
| long2 max(long2 a, long2 b); | Aggiunto al livello API 21 | 
| long3 max(long3 a, long3 b); | Aggiunto al livello API 21 | 
| long4 max(long4 a, long4 b); | Aggiunto al livello API 21 | 
| breve max(short a, breve b); | |
| short2 max(short2 a, short2 b); | |
| short3 max(short3 a, short3 b); | |
| short4 max(short4 a, short4 b); | |
| uchar max(uchar a, uchar b); | |
| uchar2 max(uchar2 a, uchar2 b); | |
| uchar3 max(uchar3 a, uchar3 b); | |
| uchar4 max(uchar4 a, uchar4 b); | |
| uint max(uint a, uint b); | |
| uint2 max(uint2 a, uint2 b); | |
| uint3 max(uint3 a, uint3 b); | |
| uint4 max(uint4 a, uint4 b); | |
| ulong max(ulong a, ulong b); | Aggiunto al livello API 21 | 
| ulong2 max(ulong2 a, ulong2 b); | Aggiunto al livello API 21 | 
| ulong3 max(ulong3 a, ulong3 b); | Aggiunto al livello API 21 | 
| ulong4 max(ulong4 a, ulong4 b); | Aggiunto al livello API 21 | 
| ushort max(ushort a, ushort b); | |
| ushort2 max(ushort2 a, ushort2 b); | |
| ushort3 max(ushort3 a, ushort3 b); | |
| ushort4 max(ushort4 a, ushort4 b); | 
Restituisce il valore massimo di due argomenti.
min : minima
| char min(char a, char b); | |
| char2 min(char2 a, char2 b); | |
| char3 min(char3 a, char3 b); | |
| char4 min(char4 a, char4 b); | |
| float min(float a, float b); | |
| float2 min(float2 a, float b); | |
| float2 min(float2 a, float2 b); | |
| float3 min(float3 a, float b); | |
| float3 min(float3 a, float3 b); | |
| float4 min(float4 a, float b); | |
| float4 min(float4 a, float4 b); | |
| half min(half a, half b); | Aggiunto al livello API 24 | 
| half2 min(half2 a, half b); | Aggiunto al livello API 24 | 
| half2 min(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 min(half3 a, half b); | Aggiunto al livello API 24 | 
| half3 min(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 min(half4 a, half b); | Aggiunto al livello API 24 | 
| half4 min(half4 a, half4 b); | Aggiunto al livello API 24 | 
| int min(int a, int b); | |
| int2 min(int2 a, int2 b); | |
| int3 min(int3 a, int3 b); | |
| int4 min(int4 a, int4 b); | |
| long min(long a, long b); | Aggiunto al livello API 21 | 
| long2 min(long2 a, long2 b); | Aggiunto al livello API 21 | 
| long3 min(long3 a, long3 b); | Aggiunto al livello API 21 | 
| long4 min(long4 a, long4 b); | Aggiunto al livello API 21 | 
| breve min(short a, breve b); | |
| short2 min(short2 a, short2 b); | |
| short3 min(short3 a, short3 b); | |
| short4 min(short4 a, short4 b); | |
| uchar min(uchar a, uchar b); | |
| uchar2 min(uchar2 a, uchar2 b); | |
| uchar3 min(uchar3 a, uchar3 b); | |
| uchar4 min(uchar4 a, uchar4 b); | |
| uint min(uint a, uint b); | |
| uint2 min(uint2 a, uint2 b); | |
| uint3 min(uint3 a, uint3 b); | |
| uint4 min(uint4 a, uint4 b); | |
| ulong min(ulong a, ulong b); | Aggiunto al livello API 21 | 
| ulong2 min(ulong2 a, ulong2 b); | Aggiunto al livello API 21 | 
| ulong3 min(ulong3 a, ulong3 b); | Aggiunto al livello API 21 | 
| ulong4 min(ulong4 a, ulong4 b); | Aggiunto al livello API 21 | 
| ushort min(ushort a, ushort b); | |
| ushort2 min(ushort2 a, ushort2 b); | |
| ushort3 min(ushort3 a, ushort3 b); | |
| ushort4 min(ushort4 a, ushort4 b); | 
Restituisce il valore minimo di due argomenti.
mix : combina due valori
| mix float(avvio in virgola mobile, interruzione in virgola mobile, frazione in virgola mobile); | |
| mix float2(avvio float2, arresto float2, frazione in virgola mobile); | |
| mix float2(avvio float2, arresto float2, frazione float2); | |
| mix float3(avvio float3, arresto float3, frazione in virgola mobile); | |
| mix float3(avvio float3, arresto float3, frazione float3); | |
| mix float4(avvio float4, arresto float4, frazione in virgola mobile); | |
| mix float4(avvio float4, arresto float4, frazione float4); | |
| half mix(metà inizio, mezza fermata, mezza frazione); | Aggiunto al livello API 24 | 
| mix half2(half2 start, half2 stop, metà frazione); | Aggiunto al livello API 24 | 
| mix half2(half2 start, half2 stop, half2 frazione); | Aggiunto al livello API 24 | 
| mix half3(half3 start, half3 stop, half frazione); | Aggiunto al livello API 24 | 
| half3 mix(half3 start, half3 stop, half3 frazione); | Aggiunto al livello API 24 | 
| mix half4(half4 start, half4 stop, metà frazione); | Aggiunto al livello API 24 | 
| mix half4(half4 start, half4 stop, half4 frazione); | Aggiunto al livello API 24 | 
Restituisce start + ((stop - start) * frazione).
 Ciò può essere utile per combinare due valori.  Ad esempio, per creare un nuovo colore con
il 40% color1 e il 60% color2, usa mix(color1, color2, 0.6f).
modf : componenti integrali e frazionari
| modf in virgola mobile(float v, float* parte_integrale); | |
| float2 modf(float2 v, float2* parte_integrale); | |
| float3 modf(float3 v, float3* parte_integrale); | |
| float4 modf(float4 v, float4* parte_integrale); | |
| half modf(half v, half* integrale_part); | Aggiunto al livello API 24 | 
| half2 modf(half2 v, half2* parte_integrale); | Aggiunto al livello API 24 | 
| half3 modf(half3 v, half3* parte_integrale); | Aggiunto al livello API 24 | 
| half4 modf(half4 v, half4* parte_integrale); | Aggiunto al livello API 24 | 
Parametri
| v | Valore di origine. | 
|---|---|
| parte_integrale | *parte_integrale verrà impostato sulla parte integrale del numero. | 
Ritorni
| Parte con virgola mobile del valore. | 
Restituisce i componenti integrali e frazionari di un numero.
Entrambi i componenti avranno lo stesso segno di x. Ad esempio, per un input di -3.72f, *integral_part verrà impostato su -3.f e verrà restituito .72f.
nan : non è un numero
| float nan(uint v); | 
Parametri
| v | Non utilizzato. | 
|---|
Restituisce un valore NaN (non un numero).
nan_half : non è un numero
| half nan_half() | Aggiunto al livello API 24 | 
Restituisce un valore NaN in virgola mobile con precisione dimezza (non un numero).
native_acos : coseno inverso approssimativo
| float native_acos(float v); | Aggiunto al livello API 21 | 
| float2 native_acos(float2 v); | Aggiunto al livello API 21 | 
| float3 native_acos(float3 v); | Aggiunto al livello API 21 | 
| float4 native_acos(float4 v); | Aggiunto al livello API 21 | 
| half native_acos(half v); | Aggiunto al livello API 24 | 
| half2 native_acos(half2 v); | Aggiunto al livello API 24 | 
| half3 native_acos(half3 v); | Aggiunto al livello API 24 | 
| half4 native_acos(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno inverso approssimativo, espresso in radianti.
Questa funzione restituisce risultati non definiti da valori di input minori di -1 o maggiori di 1.
Vedi anche acos().
native_acosh : coseno iperbolico inverso approssimativo
| float native_acosh(float v); | Aggiunto al livello API 21 | 
| float2 native_acosh(float2 v); | Aggiunto al livello API 21 | 
| float3 native_acosh(float3 v); | Aggiunto al livello API 21 | 
| float4 native_acosh(float4 v); | Aggiunto al livello API 21 | 
| half native_acosh(half v); | Aggiunto al livello API 24 | 
| half2 native_acosh(half2 v); | Aggiunto al livello API 24 | 
| half3 native_acosh(half3 v); | Aggiunto al livello API 24 | 
| half4 native_acosh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno iperbolico inverso approssimativo, espresso in radianti.
Vedi anche acosh().
native_acospi : coseno inverso approssimativo diviso per pi greco
| float native_acospi(float v); | Aggiunto al livello API 21 | 
| float2 native_acospi(float2 v); | Aggiunto al livello API 21 | 
| float3 native_acospi(float3 v); | Aggiunto al livello API 21 | 
| float4 native_acospi(float4 v); | Aggiunto al livello API 21 | 
| half native_acospi(half v); | Aggiunto al livello API 24 | 
| half2 native_acospi(half2 v); | Aggiunto al livello API 24 | 
| half3 native_acospi(half3 v); | Aggiunto al livello API 24 | 
| half4 native_acospi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno inverso approssimativo espresso in radianti, diviso per pi greco.
 Per ottenere un coseno inverso misurato in gradi, utilizza acospi(a) * 180.f.
Questa funzione restituisce risultati non definiti da valori di input minori di -1 o maggiori di 1.
Vedi anche acospi().
native_asin : seno inverso approssimativo
| float native_asin(float v); | Aggiunto al livello API 21 | 
| float2 native_asin(float2 v); | Aggiunto al livello API 21 | 
| float3 native_asin(float3 v); | Aggiunto al livello API 21 | 
| float4 native_asin(float4 v); | Aggiunto al livello API 21 | 
| half native_asin(metà v); | Aggiunto al livello API 24 | 
| half2 native_asin(half2 v); | Aggiunto al livello API 24 | 
| half3 native_asin(half3 v); | Aggiunto al livello API 24 | 
| half4 native_asin(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno inverso approssimativo, espresso in radianti.
Questa funzione restituisce risultati non definiti da valori di input minori di -1 o maggiori di 1.
Vedi anche asin().
native_asinh : seno iperbolico inverso approssimativo
| float native_asinh(float v); | Aggiunto al livello API 21 | 
| float2 native_asinh(float2 v); | Aggiunto al livello API 21 | 
| float3 native_asinh(float3 v); | Aggiunto al livello API 21 | 
| float4 native_asinh(float4 v); | Aggiunto al livello API 21 | 
| half native_asinh(metà v); | Aggiunto al livello API 24 | 
| half2 native_asinh(half2 v); | Aggiunto al livello API 24 | 
| half3 native_asinh(half3 v); | Aggiunto al livello API 24 | 
| half4 native_asinh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno iperbolico inverso approssimativo, espresso in radianti.
Vedi anche asinh().
native_asinpi : seno inverso approssimativo diviso per pi greco
| float native_asinpi(float v); | Aggiunto al livello API 21 | 
| float2 native_asinpi(float2 v); | Aggiunto al livello API 21 | 
| float3 native_asinpi(float3 v); | Aggiunto al livello API 21 | 
| float4 native_asinpi(float4 v); | Aggiunto al livello API 21 | 
| half native_asinpi(half v); | Aggiunto al livello API 24 | 
| half2 native_asinpi(half2 v); | Aggiunto al livello API 24 | 
| half3 native_asinpi(half3 v); | Aggiunto al livello API 24 | 
| half4 native_asinpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno inverso approssimativo in radianti, diviso per pi greco.
 Per ottenere un seno inverso misurato in gradi, utilizza asinpi(a) * 180.f.
Questa funzione restituisce risultati non definiti da valori di input minori di -1 o maggiori di 1.
Vedi anche asinpi().
native_atan : tangente inversa approssimativa
| float native_atan(float v); | Aggiunto al livello API 21 | 
| float2 native_atan(float2 v); | Aggiunto al livello API 21 | 
| float3 native_atan(float3 v); | Aggiunto al livello API 21 | 
| float4 native_atan(float4 v); | Aggiunto al livello API 21 | 
| half native_atan(half v); | Aggiunto al livello API 24 | 
| half2 native_atan(half2 v); | Aggiunto al livello API 24 | 
| half3 native_atan(half3 v); | Aggiunto al livello API 24 | 
| half4 native_atan(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente inversa approssimativa, in radianti.
Vedi anche atan().
native_atan2 : tangente inversa approssimativa di un rapporto
| float native_atan2(numeratore in virgola mobile, denominatore in virgola mobile); | Aggiunto al livello API 21 | 
| float2 native_atan2(numeratore float2, denominatore float2); | Aggiunto al livello API 21 | 
| float3 native_atan2(numeratore float3, denominatore float3); | Aggiunto al livello API 21 | 
| float4 native_atan2(numeratore float4, denominatore float4); | Aggiunto al livello API 21 | 
| half native_atan2(metà numeratore, metà denominatore); | Aggiunto al livello API 24 | 
| half2 native_atan2(numeratore half2, denominatore half2); | Aggiunto al livello API 24 | 
| half3 native_atan2(numeratore half3, denominatore half3); | Aggiunto al livello API 24 | 
| half4 native_atan2(numeratore half4, denominatore half4); | Aggiunto al livello API 24 | 
Parametri
| numeratore | Numeratore. | 
|---|---|
| denominatore | Denominatore. Può essere 0. | 
 Restituisce la tangente inversa approssimativa di (numerator / denominator), espressa in radianti.
Vedi anche atan2().
native_atan2pi : tangente inversa approssimativa di un rapporto, divisa per il pi greco
| float native_atan2pi(numeratore in virgola mobile, denominatore in virgola mobile); | Aggiunto al livello API 21 | 
| float2 native_atan2pi(numeratore float2, denominatore float2); | Aggiunto al livello API 21 | 
| float3 native_atan2pi(numeratore float3, denominatore float3); | Aggiunto al livello API 21 | 
| float4 native_atan2pi(numeratore float4, denominatore float4); | Aggiunto al livello API 21 | 
| half native_atan2pi(metà numeratore, metà denominatore); | Aggiunto al livello API 24 | 
| half2 native_atan2pi(numeratore half2, denominatore half2); | Aggiunto al livello API 24 | 
| half3 native_atan2pi(numeratore half3, denominatore half3); | Aggiunto al livello API 24 | 
| half4 native_atan2pi(numeratore half4, denominatore half4); | Aggiunto al livello API 24 | 
Parametri
| numeratore | Numeratore. | 
|---|---|
| denominatore | Denominatore. Può essere 0. | 
 Restituisce la tangente inversa approssimativa di (numerator / denominator), espressa in radianti, divisa per pi greco.
 Per ottenere una tangente inversa misurata in gradi, utilizza atan2pi(n, d) * 180.f.
Vedi anche atan2pi().
native_atanh : tangente iperbolica inversa approssimativa
| float native_atanh(float v); | Aggiunto al livello API 21 | 
| float2 native_atanh(float2 v); | Aggiunto al livello API 21 | 
| float3 native_atanh(float3 v); | Aggiunto al livello API 21 | 
| float4 native_atanh(float4 v); | Aggiunto al livello API 21 | 
| half native_atanh(metà v); | Aggiunto al livello API 24 | 
| half2 native_atanh(half2 v); | Aggiunto al livello API 24 | 
| half3 native_atanh(half3 v); | Aggiunto al livello API 24 | 
| half4 native_atanh(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente iperbolica inversa approssimativa, espressa in radianti.
Vedi anche atanh().
native_atanpi : tangente inversa approssimativa divisa per pi greco
| float native_atanpi(float v); | Aggiunto al livello API 21 | 
| float2 native_atanpi(float2 v); | Aggiunto al livello API 21 | 
| float3 native_atanpi(float3 v); | Aggiunto al livello API 21 | 
| float4 native_atanpi(float4 v); | Aggiunto al livello API 21 | 
| half native_atanpi(half v); | Aggiunto al livello API 24 | 
| half2 native_atanpi(half2 v); | Aggiunto al livello API 24 | 
| half3 native_atanpi(half3 v); | Aggiunto al livello API 24 | 
| half4 native_atanpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente inversa approssimativa in radianti, divisa per pi greco.
 Per ottenere una tangente inversa misurata in gradi, utilizza atanpi(a) * 180.f.
Vedi anche atanpi().
native_cbrt : radice cubica approssimativa
| float native_cbrt(float v); | Aggiunto al livello API 21 | 
| float2 native_cbrt(float2 v); | Aggiunto al livello API 21 | 
| float3 native_cbrt(float3 v); | Aggiunto al livello API 21 | 
| float4 native_cbrt(float4 v); | Aggiunto al livello API 21 | 
| half native_cbrt(half v); | Aggiunto al livello API 24 | 
| half2 native_cbrt(half2 v); | Aggiunto al livello API 24 | 
| half3 native_cbrt(half3 v); | Aggiunto al livello API 24 | 
| half4 native_cbrt(half4 v); | Aggiunto al livello API 24 | 
Restituisce la radice cubica approssimativa.
Vedi anche cbrt().
native_cos : coseno approssimativo
| float native_cos(float v); | Aggiunto al livello API 21 | 
| float2 native_cos(float2 v); | Aggiunto al livello API 21 | 
| float3 native_cos(float3 v); | Aggiunto al livello API 21 | 
| float4 native_cos(float4 v); | Aggiunto al livello API 21 | 
| half native_cos(half v); | Aggiunto al livello API 24 | 
| half2 native_cos(half2 v); | Aggiunto al livello API 24 | 
| half3 native_cos(half3 v); | Aggiunto al livello API 24 | 
| half4 native_cos(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno approssimativo di un angolo misurato in radianti.
Vedi anche cos().
native_cosh : coseno ipebolico approssimativo
| float native_cosh(float v); | Aggiunto al livello API 21 | 
| float2 native_cosh(float2 v); | Aggiunto al livello API 21 | 
| float3 native_cosh(float3 v); | Aggiunto al livello API 21 | 
| float4 native_cosh(float4 v); | Aggiunto al livello API 21 | 
| half native_cosh(half v); | Aggiunto al livello API 24 | 
| half2 native_cosh(half2 v); | Aggiunto al livello API 24 | 
| half3 native_cosh(half3 v); | Aggiunto al livello API 24 | 
| half4 native_cosh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno hypebolic approssimativo.
Vedi anche cosh().
native_cospi : coseno approssimativo di un numero moltiplicato per pi greco
| float native_cospi(float v); | Aggiunto al livello API 21 | 
| float2 native_cospi(float2 v); | Aggiunto al livello API 21 | 
| float3 native_cospi(float3 v); | Aggiunto al livello API 21 | 
| float4 native_cospi(float4 v); | Aggiunto al livello API 21 | 
| half native_cospi(half v); | Aggiunto al livello API 24 | 
| half2 native_cospi(half2 v); | Aggiunto al livello API 24 | 
| half3 native_cospi(half3 v); | Aggiunto al livello API 24 | 
| half4 native_cospi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il coseno approssimativo di (v * pi), dove (v * pi) è misurato in radianti.
 Per ottenere il coseno di un valore misurato in gradi, chiama cospi(v / 180.f).
Vedi anche cospi().
native_divide : divisione approssimativa
| float native_divide(float left_vector, float right_vector); | Aggiunto al livello API 21 | 
| float2 native_divide(float2 left_vector, float2 right_vector); | Aggiunto al livello API 21 | 
| float3 native_divide(float3 left_vector, float3 right_vector); | Aggiunto al livello API 21 | 
| float4 native_divide(float4 left_vector, float4 right_vector); | Aggiunto al livello API 21 | 
| half native_divide(half left_vector, half right_vector); | Aggiunto al livello API 24 | 
| half2 native_divide(half2 left_vector, half2 right_vector); | Aggiunto al livello API 24 | 
| half3 native_divide(half3 left_vector, half3 right_vector); | Aggiunto al livello API 24 | 
| half4 native_divide(half4 left_vector, half4 right_vector); | Aggiunto al livello API 24 | 
Calcola la divisione approssimativa di due valori.
native_exp : e approssimativo aumentato a un numero
| float native_exp(float v); | Aggiunto al livello API 18 | 
| float2 native_exp(float2 v); | Aggiunto al livello API 18 | 
| float3 native_exp(float3 v); | Aggiunto al livello API 18 | 
| float4 native_exp(float4 v); | Aggiunto al livello API 18 | 
| half native_exp(half v); | Aggiunto al livello API 24 | 
| half2 native_exp(half2 v); | Aggiunto al livello API 24 | 
| half3 native_exp(half3 v); | Aggiunto al livello API 24 | 
| half4 native_exp(half4 v); | Aggiunto al livello API 24 | 
Esper. approssimata veloce
È valido per input compresi tra -86.f e 86.f. La precisione non è peggiore di quanto ci si aspetterebbe dall'utilizzo di valori in virgola mobile a 16 bit.
Vedi anche exp().
native_exp10 : circa 10 elevati a un numero
| float native_exp10(float v); | Aggiunto al livello API 18 | 
| float2 native_exp10(float2 v); | Aggiunto al livello API 18 | 
| float3 native_exp10(float3 v); | Aggiunto al livello API 18 | 
| float4 native_exp10(float4 v); | Aggiunto al livello API 18 | 
| half native_exp10(half v); | Aggiunto al livello API 24 | 
| half2 native_exp10(half2 v); | Aggiunto al livello API 24 | 
| half3 native_exp10(half3 v); | Aggiunto al livello API 24 | 
| half4 native_exp10(half4 v); | Aggiunto al livello API 24 | 
Esp10 approssimativo veloce.
È valido per input compresi tra -37.f e 37.f. La precisione non è peggiore di quanto ci si aspetterebbe dall'utilizzo di valori in virgola mobile a 16 bit.
Vedi anche exp10().
native_exp2 : valore approssimativo di 2 elevato a un numero
| float native_exp2(float v); | Aggiunto al livello API 18 | 
| float2 native_exp2(float2 v); | Aggiunto al livello API 18 | 
| float3 native_exp2(float3 v); | Aggiunto al livello API 18 | 
| float4 native_exp2(float4 v); | Aggiunto al livello API 18 | 
| half native_exp2(half v); | Aggiunto al livello API 24 | 
| half2 native_exp2(half2 v); | Aggiunto al livello API 24 | 
| half3 native_exp2(half3 v); | Aggiunto al livello API 24 | 
| half4 native_exp2(half4 v); | Aggiunto al livello API 24 | 
Esp2 approssimativa veloce 2.
È valido per input compresi tra -125.f e 125.f. La precisione non è peggiore di quanto ci si aspetterebbe dall'utilizzo di valori in virgola mobile a 16 bit.
Vedi anche exp2().
native_expm1 : e approssimativo aumentato a un numero meno uno
| float native_expm1(float v); | Aggiunto al livello API 21 | 
| float2 native_expm1(float2 v); | Aggiunto al livello API 21 | 
| float3 native_expm1(float3 v); | Aggiunto al livello API 21 | 
| float4 native_expm1(float4 v); | Aggiunto al livello API 21 | 
| half native_expm1(half v); | Aggiunto al livello API 24 | 
| half2 native_expm1(half2 v); | Aggiunto al livello API 24 | 
| half3 native_expm1(half3 v); | Aggiunto al livello API 24 | 
| half4 native_expm1(half4 v); | Aggiunto al livello API 24 | 
Restituisce il valore approssimativo (e ^ v) - 1.
Vedi anche expm1().
native_hypot : ipotenusa approssimativa
| float native_hypot(float a, float b); | Aggiunto al livello API 21 | 
| float2 native_hypot(float2 a, float2 b); | Aggiunto al livello API 21 | 
| float3 native_hypot(float3 a, float3 b); | Aggiunto al livello API 21 | 
| float4 native_hypot(float4 a, float4 b); | Aggiunto al livello API 21 | 
| half native_hypot(half a, half b); | Aggiunto al livello API 24 | 
| half2 native_hypot(half2 a, half2 b); | Aggiunto al livello API 24 | 
| half3 native_hypot(half3 a, half3 b); | Aggiunto al livello API 24 | 
| half4 native_hypot(half4 a, half4 b); | Aggiunto al livello API 24 | 
Restituisce il valore native_sqrt approssimativo(a * a + b * b)
Vedi anche hypot().
native_log : logaritmo naturale approssimativo
| float native_log(float v); | Aggiunto al livello API 18 | 
| float2 native_log(float2 v); | Aggiunto al livello API 18 | 
| float3 native_log(float3 v); | Aggiunto al livello API 18 | 
| float4 native_log(float4 v); | Aggiunto al livello API 18 | 
| half native_log(half v); | Aggiunto al livello API 24 | 
| half2 native_log(half2 v); | Aggiunto al livello API 24 | 
| half3 native_log(half3 v); | Aggiunto al livello API 24 | 
| half4 native_log(half4 v); | Aggiunto al livello API 24 | 
native_log10 : logaritmo approssimativo in base 10
| float native_log10(float v); | Aggiunto al livello API 18 | 
| float2 native_log10(float2 v); | Aggiunto al livello API 18 | 
| float3 native_log10(float3 v); | Aggiunto al livello API 18 | 
| float4 native_log10(float4 v); | Aggiunto al livello API 18 | 
| half native_log10(half v); | Aggiunto al livello API 24 | 
| half2 native_log10(half2 v); | Aggiunto al livello API 24 | 
| half3 native_log10(half3 v); | Aggiunto al livello API 24 | 
| half4 native_log10(half4 v); | Aggiunto al livello API 24 | 
native_log1p : il logaritmo naturale approssimativo di un valore più 1
| float native_log1p(float v); | Aggiunto al livello API 21 | 
| float2 native_log1p(float2 v); | Aggiunto al livello API 21 | 
| float3 native_log1p(float3 v); | Aggiunto al livello API 21 | 
| float4 native_log1p(float4 v); | Aggiunto al livello API 21 | 
| half native_log1p(half v); | Aggiunto al livello API 24 | 
| half2 native_log1p(half2 v); | Aggiunto al livello API 24 | 
| half3 native_log1p(half3 v); | Aggiunto al livello API 24 | 
| half4 native_log1p(half4 v); | Aggiunto al livello API 24 | 
Restituisce il logaritmo naturale approssimativo di (v + 1.0f)
Vedi anche log1p().
native_log2 : logaritmo approssimativo in base 2
| float native_log2(float v); | Aggiunto al livello API 18 | 
| float2 native_log2(float2 v); | Aggiunto al livello API 18 | 
| float3 native_log2(float3 v); | Aggiunto al livello API 18 | 
| float4 native_log2(float4 v); | Aggiunto al livello API 18 | 
| half native_log2(half v); | Aggiunto al livello API 24 | 
| half2 native_log2(half2 v); | Aggiunto al livello API 24 | 
| half3 native_log2(half3 v); | Aggiunto al livello API 24 | 
| half4 native_log2(half4 v); | Aggiunto al livello API 24 | 
native_powr : base positiva approssimativa elevata a un esponente
| float native_powr(base in virgola mobile, esponente in virgola mobile); | Aggiunto al livello API 18 | 
| float2 native_powr(base float2, esponente float2); | Aggiunto al livello API 18 | 
| float3 native_powr(base float3, esponente float3); | Aggiunto al livello API 18 | 
| float4 native_powr(base float4, esponente float4); | Aggiunto al livello API 18 | 
| half native_powr(metà base, metà esponente); | Aggiunto al livello API 24 | 
| half2 native_powr(half2 base, half2 esponente); | Aggiunto al livello API 24 | 
| half3 native_powr(half3 base, half3 esponente); | Aggiunto al livello API 24 | 
| half4 native_powr(half4 base, half4 esponente); | Aggiunto al livello API 24 | 
Parametri
| base | Il valore deve essere compreso tra 0.f e 256.f. La funzione non è precisa per valori molto vicini a zero. | 
|---|---|
| esponente | Il valore deve essere compreso tra -15.f e 15.f. | 
Approssimativa veloce (base ^ esponente).
Vedi anche powr().
native_recip : reciproco approssimativo
| float native_recip(float v); | Aggiunto al livello API 21 | 
| float2 native_recip(float2 v); | Aggiunto al livello API 21 | 
| float3 native_recip(float3 v); | Aggiunto al livello API 21 | 
| float4 native_recip(float4 v); | Aggiunto al livello API 21 | 
| half native_recip(half v); | Aggiunto al livello API 24 | 
| half2 native_recip(half2 v); | Aggiunto al livello API 24 | 
| half3 native_recip(half3 v); | Aggiunto al livello API 24 | 
| half4 native_recip(half4 v); | Aggiunto al livello API 24 | 
Restituisce il reciproco approssimativo approssimativo di un valore.
Vedi anche half_recip().
native_rootn : radice n-esima approssimativa
| float native_rootn(float v, int n); | Aggiunto al livello API 21 | 
| float2 native_rootn(float2 v, int2 n); | Aggiunto al livello API 21 | 
| float3 native_rootn(float3 v, int3 n); | Aggiunto al livello API 21 | 
| float4 native_rootn(float4 v, int4 n); | Aggiunto al livello API 21 | 
| half native_rootn(half v, int n); | Aggiunto al livello API 24 | 
| half2 native_rootn(half2 v, int2 n); | Aggiunto al livello API 24 | 
| half3 native_rootn(half3 v, int3 n); | Aggiunto al livello API 24 | 
| half4 native_rootn(half4 v, int4 n); | Aggiunto al livello API 24 | 
Calcola la radice n-esima approssimativa di un valore.
Vedi anche rootn().
native_rsqrt : reciproco approssimativo di una radice quadrata
| float native_rsqrt(float v); | Aggiunto al livello API 21 | 
| float2 native_rsqrt(float2 v); | Aggiunto al livello API 21 | 
| float3 native_rsqrt(float3 v); | Aggiunto al livello API 21 | 
| float4 native_rsqrt(float4 v); | Aggiunto al livello API 21 | 
| half native_rsqrt(half v); | Aggiunto al livello API 24 | 
| half2 native_rsqrt(half2 v); | Aggiunto al livello API 24 | 
| half3 native_rsqrt(half3 v); | Aggiunto al livello API 24 | 
| half4 native_rsqrt(half4 v); | Aggiunto al livello API 24 | 
Restituisce un valore approssimativo (1 / sqrt(v)).
Vedi anche rsqrt(), half_rsqrt().
native_sin : seno approssimativo
| float native_sin(float v); | Aggiunto al livello API 21 | 
| float2 native_sin(float2 v); | Aggiunto al livello API 21 | 
| float3 native_sin(float3 v); | Aggiunto al livello API 21 | 
| float4 native_sin(float4 v); | Aggiunto al livello API 21 | 
| half native_sin(half v); | Aggiunto al livello API 24 | 
| half2 native_sin(half2 v); | Aggiunto al livello API 24 | 
| half3 native_sin(half3 v); | Aggiunto al livello API 24 | 
| half4 native_sin(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno approssimativo di un angolo misurato in radianti.
Vedi anche sin().
native_sincos : seno e coseno approssimativi
| float native_sincos(float v, float* cos); | Aggiunto al livello API 21 | 
| float2 native_sincos(float2 v, float2* cos); | Aggiunto al livello API 21 | 
| float3 native_sincos(float3 v, float3* cos); | Aggiunto al livello API 21 | 
| float4 native_sincos(float4 v, float4* cos); | Aggiunto al livello API 21 | 
| half native_sincos(half v, half* cos); | Aggiunto al livello API 24 | 
| half2 native_sincos(half2 v, half2* cos); | Aggiunto al livello API 24 | 
| half3 native_sincos(half3 v, half3* cos); | Aggiunto al livello API 24 | 
| half4 native_sincos(half4 v, half4* cos); | Aggiunto al livello API 24 | 
Parametri
| v | Valore in entrata in radianti. | 
|---|---|
| cos | *cos verrà impostato sul valore coseno. | 
Ritorni
| Seno. | 
Restituisce il seno e il coseno approssimativi di un valore.
Vedi anche sincos().
native_sinh : seno iperbolico approssimativo
| float native_sinh(float v); | Aggiunto al livello API 21 | 
| float2 native_sinh(float2 v); | Aggiunto al livello API 21 | 
| float3 native_sinh(float3 v); | Aggiunto al livello API 21 | 
| float4 native_sinh(float4 v); | Aggiunto al livello API 21 | 
| half native_sinh(half v); | Aggiunto al livello API 24 | 
| half2 native_sinh(half2 v); | Aggiunto al livello API 24 | 
| half3 native_sinh(half3 v); | Aggiunto al livello API 24 | 
| half4 native_sinh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno iperbolico approssimativo di un valore specificato in radianti.
Vedi anche sinh().
native_sinpi : seno approssimativo di un numero moltiplicato per pi greco
| float native_sinpi(float v); | Aggiunto al livello API 21 | 
| float2 native_sinpi(float2 v); | Aggiunto al livello API 21 | 
| float3 native_sinpi(float3 v); | Aggiunto al livello API 21 | 
| float4 native_sinpi(float4 v); | Aggiunto al livello API 21 | 
| half native_sinpi(half v); | Aggiunto al livello API 24 | 
| half2 native_sinpi(half2 v); | Aggiunto al livello API 24 | 
| half3 native_sinpi(half3 v); | Aggiunto al livello API 24 | 
| half4 native_sinpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno approssimativo di (v * pi), dove (v * pi) viene misurato in radianti.
 Per ottenere il seno di un valore misurato in gradi, chiama sinpi(v / 180.f).
Vedi anche sinpi().
native_sqrt : radice quadrata approssimativa
| float native_sqrt(float v); | Aggiunto al livello API 21 | 
| float2 native_sqrt(float2 v); | Aggiunto al livello API 21 | 
| float3 native_sqrt(float3 v); | Aggiunto al livello API 21 | 
| float4 native_sqrt(float4 v); | Aggiunto al livello API 21 | 
| half native_sqrt(half v); | Aggiunto al livello API 24 | 
| half2 native_sqrt(half2 v); | Aggiunto al livello API 24 | 
| half3 native_sqrt(half3 v); | Aggiunto al livello API 24 | 
| half4 native_sqrt(half4 v); | Aggiunto al livello API 24 | 
native_tan : tangente approssimativa
| float native_tan(float v); | Aggiunto al livello API 21 | 
| float2 native_tan(float2 v); | Aggiunto al livello API 21 | 
| float3 native_tan(float3 v); | Aggiunto al livello API 21 | 
| float4 native_tan(float4 v); | Aggiunto al livello API 21 | 
| half native_tan(half v); | Aggiunto al livello API 24 | 
| half2 native_tan(half2 v); | Aggiunto al livello API 24 | 
| half3 native_tan(half3 v); | Aggiunto al livello API 24 | 
| half4 native_tan(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente approssimativa di un angolo misurato in radianti.
native_tanh : tangente iperbolica approssimativa
| float native_tanh(float v); | Aggiunto al livello API 21 | 
| float2 native_tanh(float2 v); | Aggiunto al livello API 21 | 
| float3 native_tanh(float3 v); | Aggiunto al livello API 21 | 
| float4 native_tanh(float4 v); | Aggiunto al livello API 21 | 
| half native_tanh(half v); | Aggiunto al livello API 24 | 
| half2 native_tanh(half2 v); | Aggiunto al livello API 24 | 
| half3 native_tanh(half3 v); | Aggiunto al livello API 24 | 
| half4 native_tanh(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente iperbolica approssimativa di un valore.
Vedi anche tanh().
native_tanpi : tangente approssimativa di un numero moltiplicata per pi greco
| float native_tanpi(float v); | Aggiunto al livello API 21 | 
| float2 native_tanpi(float2 v); | Aggiunto al livello API 21 | 
| float3 native_tanpi(float3 v); | Aggiunto al livello API 21 | 
| float4 native_tanpi(float4 v); | Aggiunto al livello API 21 | 
| half native_tanpi(half v); | Aggiunto al livello API 24 | 
| half2 native_tanpi(half2 v); | Aggiunto al livello API 24 | 
| half3 native_tanpi(half3 v); | Aggiunto al livello API 24 | 
| half4 native_tanpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente approssimativa di (v * pi), dove (v * pi) viene misurata in radianti.
 Per ottenere la tangente di un valore misurato in gradi, chiama tanpi(v / 180.f).
Vedi anche tanpi().
nextafter : numero con rappresentazione in virgola mobile successivo
| float nextafter(float v, float target); | |
| float2 nextafter(float2 v, float2 target); | |
| float3 nextafter(float3 v, float3 target); | |
| float4 nextafter(float4 v, float4 target); | |
| half nextafter(half v, half target); | Aggiunto al livello API 24 | 
| half2 nextafter(half2 v, half2 target); | Aggiunto al livello API 24 | 
| half3 nextafter(half3 v, half3 target); | Aggiunto al livello API 24 | 
| half4 nextafter(half4 v, half4 target); | Aggiunto al livello API 24 | 
Restituisce il successivo numero in virgola mobile rappresentabile da v verso il target.
In modalità rs_fp_relaxed, un valore di input denormalizzato potrebbe non restituire il valore denormalizzato successivo, poiché il supporto di valori denormalizzati è facoltativo in modalità relax.
pow : base elevata a un esponente
| float pow(base in virgola mobile, esponente float); | |
| float2 pow(base float2, esponente float2); | |
| float3 pow(base float3, esponente float3); | |
| float4 pow(base float4, esponente float4); | |
| mezza pow(metà base, metà esponente); | Aggiunto al livello API 24 | 
| half2 pow(half2 base, half2 esponente); | Aggiunto al livello API 24 | 
| half3 pow(half3 base, half3 esponente); | Aggiunto al livello API 24 | 
| half4 pow(half4 base, half4 esponente); | Aggiunto al livello API 24 | 
pown : base elevata a un esponente intero
| float pown(base in virgola mobile, esponente int); | |
| float2 pown(base float2, esponente int2); | |
| float3 pown(base float3, esponente int3); | |
| float4 pown(base float4, esponente int4); | |
| mezza pown(mezza base, esponente int); | Aggiunto al livello API 24 | 
| half2 pown(half2 base, int2 esponente); | Aggiunto al livello API 24 | 
| half3 pown(half3 base, int3 esponente); | Aggiunto al livello API 24 | 
| half4 pown(half4 base, int4 esponente); | Aggiunto al livello API 24 | 
powr : base positiva elevata a un esponente
| float powr(base in virgola mobile, esponente float); | |
| float2 powr(base float2, esponente float2); | |
| float3 powr(base float3, esponente float3); | |
| float4 powr(base float4, esponente float4); | |
| mezza powr(metà base, metà esponente); | Aggiunto al livello API 24 | 
| half2 powr(half2 base, half2 esponente); | Aggiunto al livello API 24 | 
| half3 powr(half3 base, half3 esponente); | Aggiunto al livello API 24 | 
| half4 powr(half4 base, half4 esponente); | Aggiunto al livello API 24 | 
Restituisce la base elevata all'esponente di potenza, ad esempio base ^ esponente. la base deve essere >= 0.
pow() e pown() sono simili. Entrambi non fanno ipotesi sulla base. pow() prende un esponente in virgola mobile, mentre pown() prende un numero intero.
Vedi anche la funzione native_powr().
radianti : converte i gradi in radianti
| radianti in virgola mobile(float v); | |
| float2 radianti(float2 v); | |
| float3 radianti(float3 v); | |
| float4 radianti(float4 v); | |
| mezzi radianti(metà v); | Aggiunto al livello API 24 | 
| half2 radianti(half2 v); | Aggiunto al livello API 24 | 
| half3 radianti(half3 v); | Aggiunto al livello API 24 | 
| half4 radianti(half4 v); | Aggiunto al livello API 24 | 
Converte da gradi a radianti.
resto : resto di una divisione
| resto in virgola mobile(numeratore in virgola mobile, denominatore in virgola mobile); | |
| float2 resto(numeratore float2, denominatore float2); | |
| float3 resto(numeratore float3, denominatore float3); | |
| float4 resto(numeratore float4, denominatore float4); | |
| metà resto(metà numeratore, metà denominatore); | Aggiunto al livello API 24 | 
| half2 resto(half2 numeratore, half2 denominatore); | Aggiunto al livello API 24 | 
| half3 resto(half3 numeratore, half3 denominatore); | Aggiunto al livello API 24 | 
| half4 resto(half4 numeratore, half4 denominatore); | Aggiunto al livello API 24 | 
Restituisce il resto di (numeratore / denominatore), in cui il quoziente viene arrotondato al numero intero più vicino.
 La funzione fmod() è simile, ma arrotonda al numero intero più vicino.
Ad esempio, fmod(-3.8f, 2.f) restituisce -1.8f (-3.8f - -1.f * 2.f)
mentre remainder(-3.8f, 2.f) restituisce 0.2f (-3.8f - -2.f * 2.f).
remquo : resto e quoziente di una divisione
| remquo in virgola mobile(numeratore in virgola mobile, denominatore in virgola mobile, int* quoziente); | |
| float2 remquo(numeratore float2, denominatore float2, int2* quoziente); | |
| float3 remquo(numeratore float3, denominatore float3, int3* quoziente); | |
| float4 remquo(numeratore float4, denominatore float4, int4* quoziente); | |
| mezza remquo(metà numeratore, metà denominatore, int* quoziente); | Aggiunto al livello API 24 | 
| half2 remquo(half2 numeratore, half2 denominatore, int2* quoziente); | Aggiunto al livello API 24 | 
| half3 remquo(half3 numeratore, half3 denominatore, int3* quoziente); | Aggiunto al livello API 24 | 
| half4 remquo(half4 numeratore, half4 denominatore, int4* quoziente); | Aggiunto al livello API 24 | 
Parametri
| numeratore | Numeratore. | 
|---|---|
| denominatore | Denominatore. | 
| quoziente | *Il quoziente verrà impostato sul quoziente intero. | 
Ritorni
| Resto, precisione solo per i tre bit bassi. | 
Restituisce il quoziente e il resto di (numeratore / denominatore).
Solo il segno e i tre bit più bassi del quoziente sono garantiti per essere precisi.
 Questa funzione è utile per implementare funzioni periodiche.  I tre bit bassi del quoziente danno al quadrante e al resto la distanza all'interno del quadrante.
Ad esempio, un'implementazione di sin(x) potrebbe chiamare remquo(x, PI / 2.f, &quadrant) per ridurre il valore molto grande di x a un valore compreso in un intervallo limitato.
 Esempio: remquo(-23.5f, 8.f, ") imposta i tre bit più bassi del quot su 3 e il segno negativo.  Restituisce 0.5f.
rint : arrotonda a pari
| float rint(float v); | |
| float2 rint(float2 v); | |
| float3 rint(float3 v); | |
| float4 rint(float4 v); | |
| half rint(metà v); | Aggiunto al livello API 24 | 
| half2 rint(half2 v); | Aggiunto al livello API 24 | 
| half3 rint(half3 v); | Aggiunto al livello API 24 | 
| half4 rint(half4 v); | Aggiunto al livello API 24 | 
Arrotonda al valore integrale più vicino.
 rint() arrotonda i valori di metà a pareggio.  Ad esempio, rint(0.5f) restituisce 0.f,
mentre rint(1.5f) restituisce 2.f.  Allo stesso modo, rint(-0.5f) restituisce -0.f e
rint(-1.5f) restituisce -2.f.
round() è simile ma arrotonda in base allo zero. trunc() tronca la frazione decimale.
rootn : radice n-esima
| float rootn(float v, int n); | |
| float2 rootn(float2 v, int2 n); | |
| float3 rootn(float3 v, int3 n); | |
| float4 rootn(float4 v, int4 n); | |
| half rootn(half v, int n); | Aggiunto al livello API 24 | 
| half2 rootn(half2 v, int2 n); | Aggiunto al livello API 24 | 
| half3 rootn(half3 v, int3 n); | Aggiunto al livello API 24 | 
| half4 rootn(half4 v, int4 n); | Aggiunto al livello API 24 | 
Calcola la radice n-esima di un valore.
Vedi anche native_rootn().
round : arrotonda in base allo zero
| float round(float v); | |
| float2 round(float2 v); | |
| float3 round(float3 v); | |
| float4 round(float4 v); | |
| half round(metà v); | Aggiunto al livello API 24 | 
| half2 round(half2 v); | Aggiunto al livello API 24 | 
| half3 round(half3 v); | Aggiunto al livello API 24 | 
| half4 round(half4 v); | Aggiunto al livello API 24 | 
Arrotondare al valore integrale più vicino.
 round() arrotonda i valori dimezzati da zero.  Ad esempio, round(0.5f) restituisce 1.f
e round(1.5f) restituisce 2.f.  Allo stesso modo, round(-0.5f) restituisce -1.f
e round(-1.5f) restituisce -2.f.
rint() è simile, ma arrotonda metà dei valori al valore pari. trunc() tronca la frazione decimale.
rsClamp : limita un valore a un intervallo
| char rsClamp(quantità caratteri, livello caratteri basso, valore caratteri alto); | |
| int rsClamp(importo int, int basso, int alto); | |
| breve rsClamp(breve quantità, breve bassa, breve alta); | |
| uchar rsClamp(importo uchar, uchar basso, uchar alto); | |
| uint rsClamp(importo uint, uint basso, uint alto); | |
| ushort rsClamp(ushort importo, ushort basso, ushort alto); | 
Parametri
| importo | Valore da fissare. | 
|---|---|
| basso | Limite inferiore. | 
| alto | Limite superiore. | 
Obsoleta. Usa invece clamp().
Inserisci un valore compreso tra basso e alto.
rsFrac : restituisce la parte frazionata di un valore in virgola mobile
| float rsFrac(float v); | 
Obsoleta. Usa invece fract().
Restituisce la parte frazionata di un float
rsRand : numero pseudo-casuale
| float rsRand(float max_value); | |
| float rsRand(float min_value, float max_value); | |
| int rsRand(int max_value); | |
| int rsRand(int min_value, int max_value); | 
Restituisce un valore casuale compreso tra 0 (o min_value) e max_malue.
rsqrt : reciproca di una radice quadrata
| float rsqrt(float v); | |
| float2 rsqrt(float2 v); | |
| float3 rsqrt(float3 v); | |
| float4 rsqrt(float4 v); | |
| half rsqrt(half v); | Aggiunto al livello API 24 | 
| half2 rsqrt(half2 v); | Aggiunto al livello API 24 | 
| half3 rsqrt(half3 v); | Aggiunto al livello API 24 | 
| half4 rsqrt(half4 v); | Aggiunto al livello API 24 | 
Restituisce (1 / radice quadrata(v)).
Vedi anche half_rsqrt(), native_rsqrt().
segno : segno di un valore
| simbolo in virgola mobile(float v); | |
| float2 sign(float2 v); | |
| float3 sign(float3 v); | |
| float4 sign(float4 v); | |
| half sign(half v); | Aggiunto al livello API 24 | 
| half2 sign(half2 v); | Aggiunto al livello API 24 | 
| half3 sign(half3 v); | Aggiunto al livello API 24 | 
| half4 sign(half4 v); | Aggiunto al livello API 24 | 
Restituisce il segno di un valore.
if (v < 0) returns -1.f; else if (v > 0) returns 1.f; else Return 0.f;
sin : seno
| float sin(float v); | |
| float2 sin(float2 v); | |
| float3 sin(float3 v); | |
| float4 sin(float4 v); | |
| half sin(half v); | Aggiunto al livello API 24 | 
| half2 sin(half2 v); | Aggiunto al livello API 24 | 
| half3 sin(half3 v); | Aggiunto al livello API 24 | 
| half4 sin(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno di un angolo misurato in radianti.
Vedi anche la funzione native_sin().
sincos : seno e coseno
| float sincos(float v, float* cos); | |
| float2 sincos(float2 v, float2* cos); | |
| float3 sincos(float3 v, float3* cos); | |
| float4 sincos(float4 v, float4* cos); | |
| half sincos(half v, half* cos); | Aggiunto al livello API 24 | 
| half2 sincos(half2 v, half2* cos); | Aggiunto al livello API 24 | 
| half3 sincos(half3 v, half3* cos); | Aggiunto al livello API 24 | 
| half4 sincos(half4 v, half4* cos); | Aggiunto al livello API 24 | 
Parametri
| v | Valore in entrata in radianti. | 
|---|---|
| cos | *cos verrà impostato sul valore coseno. | 
Ritorni
| Seno di v. | 
Restituisce il seno e il coseno di un valore.
Vedi anche la funzione native_sincos().
sinh : seno iperbolico
| float sinh(float v); | |
| float2 sinh(float2 v); | |
| float3 sinh(float3 v); | |
| float4 sinh(float4 v); | |
| half sinh(half v); | Aggiunto al livello API 24 | 
| half2 sinh(half2 v); | Aggiunto al livello API 24 | 
| half3 sinh(half3 v); | Aggiunto al livello API 24 | 
| half4 sinh(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno iperbolico di v, dove v è misurato in radianti.
Vedi anche la funzione native_sinh().
sinpi : seno di un numero moltiplicato per pi greco
| float sinpi(float v); | |
| float2 sinpi(float2 v); | |
| float3 sinpi(float3 v); | |
| float4 sinpi(float4 v); | |
| half sinpi(half v); | Aggiunto al livello API 24 | 
| half2 sinpi(half2 v); | Aggiunto al livello API 24 | 
| half3 sinpi(half3 v); | Aggiunto al livello API 24 | 
| half4 sinpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce il seno di (v * pi), dove (v * pi) è misurato in radianti.
 Per ottenere il seno di un valore misurato in gradi, chiama sinpi(v / 180.f).
Vedi anche la funzione native_sinpi().
sqrt : radice quadrata
| float radice(float v); | |
| float2(float2 v); | |
| float3(float3 v); | |
| float4(float4 v); | |
| metà metà mq(metà v); | Aggiunto al livello API 24 | 
| half2 radice quadrata(half2 v); | Aggiunto al livello API 24 | 
| half3 radice quadrata(half3 v); | Aggiunto al livello API 24 | 
| half4 radice quadrata(half4 v); | Aggiunto al livello API 24 | 
Restituisce la radice quadrata di un valore.
Vedi anche half_sqrt(), native_sqrt().
step : 0 se è inferiore a un valore, altrimenti 1
| passo in virgola mobile(bordo in virgola mobile, float v); | |
| float2 step(bordo in virgola mobile, float2 v); | Aggiunto al livello API 21 | 
| float2 step(float2 bordo, float v); | |
| float2 step(float2 bordo, float2 v); | |
| float3 step(bordo in virgola mobile, float3 v); | Aggiunto al livello API 21 | 
| float3 step(float3 bordo, float v); | |
| float3 step(float3 bordo, float3 v); | |
| float4 step(bordo in virgola mobile, float4 v); | Aggiunto al livello API 21 | 
| float4 step(float4 bordo, float v); | |
| float4 step(float4 bordo, float4 v); | |
| half step(mezza bordo, mezza v); | Aggiunto al livello API 24 | 
| half2 step(half edge, half2 v); | Aggiunto al livello API 24 | 
| half2 step(half2 edge, half v); | Aggiunto al livello API 24 | 
| half2 step(half2 edge, half2 v); | Aggiunto al livello API 24 | 
| half3 step(half edge, half3 v); | Aggiunto al livello API 24 | 
| half3 step(half3 edge, half v); | Aggiunto al livello API 24 | 
| half3 step(half3 edge, half3 v); | Aggiunto al livello API 24 | 
| half4 step(half edge, half4 v); | Aggiunto al livello API 24 | 
| half4 step(half4 edge, half v); | Aggiunto al livello API 24 | 
| half4 step(half4 edge, half4 v); | Aggiunto al livello API 24 | 
Restituisce 0.f se v < bordo, altrimenti 1.f.
 Questo può essere utile per creare calcoli condizionali senza utilizzare loop e istruzioni di diramazione.  Ad esempio, anziché calcolare (a[i] < b[i]) ? 0.f : atan2(a[i], b[i])
per gli elementi corrispondenti di un vettore, puoi utilizzare step(a, b) * atan2(a, b).
tan : Tangente
| float tan(float v); | |
| float2 tan(float2 v); | |
| float3 tan(float3 v); | |
| float4 tan(float4 v); | |
| half tan(half v); | Aggiunto al livello API 24 | 
| half2 tan(half2 v); | Aggiunto al livello API 24 | 
| half3 tan(half3 v); | Aggiunto al livello API 24 | 
| half4 tan(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente di un angolo misurato in radianti.
Vedi anche la funzione native_tan().
tanh : tangente iperbolica
| float tanh(float v); | |
| float2 tanh(float2 v); | |
| float3 tanh(float3 v); | |
| float4 tanh(float4 v); | |
| half tanh(half v); | Aggiunto al livello API 24 | 
| half2 tanh(half2 v); | Aggiunto al livello API 24 | 
| half3 tanh(half3 v); | Aggiunto al livello API 24 | 
| half4 tanh(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente iperbolica di un valore.
Vedi anche la funzione native_tanh().
tanpi : tangente di un numero moltiplicato per pi greco
| float tanpi(float v); | |
| float2 tanpi(float2 v); | |
| float3 tanpi(float3 v); | |
| float4 tanpi(float4 v); | |
| half tanpi(half v); | Aggiunto al livello API 24 | 
| half2 tanpi(half2 v); | Aggiunto al livello API 24 | 
| half3 tanpi(half3 v); | Aggiunto al livello API 24 | 
| half4 tanpi(half4 v); | Aggiunto al livello API 24 | 
Restituisce la tangente di (v * pi), dove (v * pi) viene misurata in radianti.
 Per ottenere la tangente di un valore misurato in gradi, chiama tanpi(v / 180.f).
Vedi anche la funzione native_tanpi().
tgamma : funzione gamma
| float tgamma(float v); | |
| float2 tgamma(float2 v); | |
| float3 tgamma(float3 v); | |
| float4 tgamma(float4 v); | |
| half tgamma(metà v); | Aggiunto al livello API 24 | 
| half2 tgamma(half2 v); | Aggiunto al livello API 24 | 
| half3 tgamma(half3 v); | Aggiunto al livello API 24 | 
| half4 tgamma(half4 v); | Aggiunto al livello API 24 | 
Restituisce la funzione gamma di un valore.
Vedi anche lgamma().
trunc : tronca una rappresentazione in virgola mobile
| float trunc(float v); | |
| float2 trunc(float2 v); | |
| float3 trunc(float3 v); | |
| float4 trunc(float4 v); | |
| half trunc(half v); | Aggiunto al livello API 24 | 
| half2 trunc(half2 v); | Aggiunto al livello API 24 | 
| half3 trunc(half3 v); | Aggiunto al livello API 24 | 
| half4 trunc(half4 v); | Aggiunto al livello API 24 | 
