This document includes math equations (highlighted in red) which are best viewed with Firefox version 4.0 or higher, or another MathML-aware browser. There is also a PDF version of this document.

NVIDIA CUDA Math API

Modules

Mathematical Functions

Description

CUDA mathematical functions are always available in device code. Some functions are also available in host code as indicated.

Note that floating-point functions are overloaded for different argument types. For example, the log() function has the following prototypes:

‎ double log(double x);
 float log(float x);
 float logf(float x);

Single Precision Mathematical Functions

Description

This section describes single precision mathematical functions.

Functions

__device__ ​ float acosf ( float  x )
Calculate the arc cosine of the input argument.
__device__ ​ float acoshf ( float  x )
Calculate the nonnegative arc hyperbolic cosine of the input argument.
__device__ ​ float asinf ( float  x )
Calculate the arc sine of the input argument.
__device__ ​ float asinhf ( float  x )
Calculate the arc hyperbolic sine of the input argument.
__device__ ​ float atan2f ( float  x, float  y )
Calculate the arc tangent of the ratio of first and second input arguments.
__device__ ​ float atanf ( float  x )
Calculate the arc tangent of the input argument.
__device__ ​ float atanhf ( float  x )
Calculate the arc hyperbolic tangent of the input argument.
__device__ ​ float cbrtf ( float  x )
Calculate the cube root of the input argument.
__device__ ​ float ceilf ( float  x )
Calculate ceiling of the input argument.
__device__ ​ float copysignf ( float  x, float  y )
Create value with given magnitude, copying sign of second value.
__device__ ​ float cosf ( float  x )
Calculate the cosine of the input argument.
__device__ ​ float coshf ( float  x )
Calculate the hyperbolic cosine of the input argument.
__device__ ​ float cospif ( float  x )
Calculate the cosine of the input argument $\times \pi$ ×π.
__device__ ​ float erfcf ( float  x )
Calculate the complementary error function of the input argument.
__device__ ​ float erfcinvf ( float  y )
Calculate the inverse complementary error function of the input argument.
__device__ ​ float erfcxf ( float  x )
Calculate the scaled complementary error function of the input argument.
__device__ ​ float erff ( float  x )
Calculate the error function of the input argument.
__device__ ​ float erfinvf ( float  y )
Calculate the inverse error function of the input argument.
__device__ ​ float exp10f ( float  x )
Calculate the base 10 exponential of the input argument.
__device__ ​ float exp2f ( float  x )
Calculate the base 2 exponential of the input argument.
__device__ ​ float expf ( float  x )
Calculate the base $e$ e exponential of the input argument.
__device__ ​ float expm1f ( float  x )
Calculate the base $e$ e exponential of the input argument, minus 1.
__device__ ​ float fabsf ( float  x )
Calculate the absolute value of its argument.
__device__ ​ float fdimf ( float  x, float  y )
Compute the positive difference between x and y.
__device__ ​ float fdividef ( float  x, float  y )
Divide two floating point values.
__device__ ​ float floorf ( float  x )
Calculate the largest integer less than or equal to x.
__device__ ​ float fmaf ( float  x, float  y, float  z )
Compute $x \times y + z$ x×y+z as a single operation.
__device__ ​ float fmaxf ( float  x, float  y )
Determine the maximum numeric value of the arguments.
__device__ ​ float fminf ( float  x, float  y )
Determine the minimum numeric value of the arguments.
__device__ ​ float fmodf ( float  x, float  y )
Calculate the floating-point remainder of x / y.
__device__ ​ float frexpf ( float  x, int* nptr )
Extract mantissa and exponent of a floating-point value.
__device__ ​ float hypotf ( float  x, float  y )
Calculate the square root of the sum of squares of two arguments.
__device__ ​ int ilogbf ( float  x )
Compute the unbiased integer exponent of the argument.
__device__ ​ int isfinite ( float  a )
Determine whether argument is finite.
__device__ ​ int isinf ( float  a )
Determine whether argument is infinite.
__device__ ​ int isnan ( float  a )
Determine whether argument is a NaN.
__device__ ​ float j0f ( float  x )
Calculate the value of the Bessel function of the first kind of order 0 for the input argument.
__device__ ​ float j1f ( float  x )
Calculate the value of the Bessel function of the first kind of order 1 for the input argument.
__device__ ​ float jnf ( int  n, float  x )
Calculate the value of the Bessel function of the first kind of order n for the input argument.
__device__ ​ float ldexpf ( float  x, int  exp )
Calculate the value of $x\cdot 2^{exp}$ x⋅2exp.
__device__ ​ float lgammaf ( float  x )
Calculate the natural logarithm of the absolute value of the gamma function of the input argument.
__device__ ​ long long int llrintf ( float  x )
Round input to nearest integer value.
__device__ ​ long long int llroundf ( float  x )
Round to nearest integer value.
__device__ ​ float log10f ( float  x )
Calculate the base 10 logarithm of the input argument.
__device__ ​ float log1pf ( float  x )
Calculate the value of $log_{e}(1+x)$ $\lfloor x \rfloor$ loge(1+x).
__device__ ​ float log2f ( float  x )
Calculate the base 2 logarithm of the input argument.
__device__ ​ float logbf ( float  x )
Calculate the floating point representation of the exponent of the input argument.
__device__ ​ float logf ( float  x )
Calculate the natural logarithm of the input argument.
__device__ ​ long int lrintf ( float  x )
Round input to nearest integer value.
__device__ ​ long int lroundf ( float  x )
Round to nearest integer value.
__device__ ​ float modff ( float  x, float* iptr )
Break down the input argument into fractional and integral parts.
__device__ ​ float nanf ( const char* tagp )
Returns "Not a Number" value.
__device__ ​ float nearbyintf ( float  x )
Round the input argument to the nearest integer.
__device__ ​ float nextafterf ( float  x, float  y )
Return next representable single-precision floating-point value afer argument.
__device__ ​ float normcdff ( float  y )
Calculate the standard normal cumulative distribution function.
__device__ ​ float normcdfinvf ( float  y )
Calculate the inverse of the standard normal cumulative distribution function.
__device__ ​ float powf ( float  x, float  y )
Calculate the value of first argument to the power of second argument.
__device__ ​ float rcbrtf ( float  x )
Calculate reciprocal cube root function.
__device__ ​ float remainderf ( float  x, float  y )
Compute single-precision floating-point remainder.
__device__ ​ float remquof ( float  x, float  y, int* quo )
Compute single-precision floating-point remainder and part of quotient.
__device__ ​ float rintf ( float  x )
Round input to nearest integer value in floating-point.
__device__ ​ float roundf ( float  x )
Round to nearest integer value in floating-point.
__device__ ​ float rsqrtf ( float  x )
Calculate the reciprocal of the square root of the input argument.
__device__ ​ float scalblnf ( float  x, long int  n )
Scale floating-point input by integer power of two.
__device__ ​ float scalbnf ( float  x, int  n )
Scale floating-point input by integer power of two.
__device__ ​ int signbit ( float  a )
Return the sign bit of the input.
__device__ ​ void sincosf ( float  x, float* sptr, float* cptr )
Calculate the sine and cosine of the first input argument.
__device__ ​ void sincospif ( float  x, float* sptr, float* cptr )
Calculate the sine and cosine of the first input argument $\times \pi$ ×π.
__device__ ​ float sinf ( float  x )
Calculate the sine of the input argument.
__device__ ​ float sinhf ( float  x )
Calculate the hyperbolic sine of the input argument.
__device__ ​ float sinpif ( float  x )
Calculate the sine of the input argument $\times \pi$ ×π.
__device__ ​ float sqrtf ( float  x )
Calculate the square root of the input argument.
__device__ ​ float tanf ( float  x )
Calculate the tangent of the input argument.
__device__ ​ float tanhf ( float  x )
Calculate the hyperbolic tangent of the input argument.
__device__ ​ float tgammaf ( float  x )
Calculate the gamma function of the input argument.
__device__ ​ float truncf ( float  x )
Truncate input argument to the integral part.
__device__ ​ float y0f ( float  x )
Calculate the value of the Bessel function of the second kind of order 0 for the input argument.
__device__ ​ float y1f ( float  x )
Calculate the value of the Bessel function of the second kind of order 1 for the input argument.
__device__ ​ float ynf ( int  n, float  x )
Calculate the value of the Bessel function of the second kind of order n for the input argument.

Functions

__device__ ​ float acosf ( float  x )

Calculate the arc cosine of the input argument. Calculate the principal value of the arc cosine of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Result will be in radians, in the interval [0, π ] for x inside [-1, +1].

  • acosf(1) returns +0.
  • acosf(x) returns NaN for x outside [-1, +1].

__device__ ​ float acoshf ( float  x )

Calculate the nonnegative arc hyperbolic cosine of the input argument. Calculate the nonnegative arc hyperbolic cosine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Result will be in the interval [0, + ].

  • acoshf(1) returns 0.
  • acoshf(x) returns NaN for x in the interval [ , 1).

__device__ ​ float asinf ( float  x )

Calculate the arc sine of the input argument. Calculate the principal value of the arc sine of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Result will be in radians, in the interval [- π / 2 , + π / 2 ] for x inside [-1, +1].

  • asinf(0) returns +0.
  • asinf(x) returns NaN for x outside [-1, +1].

__device__ ​ float asinhf ( float  x )

Calculate the arc hyperbolic sine of the input argument. Calculate the arc hyperbolic sine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • asinhf(0) returns 1.

__device__ ​ float atan2f ( float  x, float  y )

Calculate the arc tangent of the ratio of first and second input arguments. Calculate the principal value of the arc tangent of the ratio of first and second input arguments x / y. The quadrant of the result is determined by the signs of inputs x and y.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Result will be in radians, in the interval [- π , + π ].

  • atan2f(0, 1) returns +0.

__device__ ​ float atanf ( float  x )

Calculate the arc tangent of the input argument. Calculate the principal value of the arc tangent of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Result will be in radians, in the interval [- π / 2 , + π / 2 ].

  • atanf(0) returns +0.

__device__ ​ float atanhf ( float  x )

Calculate the arc hyperbolic tangent of the input argument. Calculate the arc hyperbolic tangent of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • atanhf( ± 0 ) returns ± 0 .
  • atanhf( ± 1 ) returns ± .
  • atanhf(x) returns NaN for x outside interval [-1, 1].

__device__ ​ float cbrtf ( float  x )

Calculate the cube root of the input argument. Calculate the cube root of x, x 1 / 3 .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x 1 / 3 .

  • cbrtf( ± 0 ) returns ± 0 .
  • cbrtf( ± ) returns ± .

__device__ ​ float ceilf ( float  x )

Calculate ceiling of the input argument. Compute the smallest integer value not less than x.

Returns

Returns x expressed as a floating-point number.

  • ceilf( ± 0 ) returns ± 0 .
  • ceilf( ± ) returns ± .

__device__ ​ float copysignf ( float  x, float  y )

Create value with given magnitude, copying sign of second value. Create a floating-point value with the magnitude x and the sign of y.

Returns

Returns a value with the magnitude of x and the sign of y.

__device__ ​ float cosf ( float  x )

Calculate the cosine of the input argument. Calculate the cosine of the input argument x (measured in radians).

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

  • cosf(0) returns 1.
  • cosf( ± ) returns NaN.

__device__ ​ float coshf ( float  x )

Calculate the hyperbolic cosine of the input argument. Calculate the hyperbolic cosine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • coshf(0) returns 1.
  • coshf( ± ) returns NaN.

__device__ ​ float cospif ( float  x )

Calculate the cosine of the input argument $\times \pi$ ×π. Calculate the cosine of x × π (measured in radians), where x is the input argument.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • cospif( ± 0 ) returns 1.
  • cospif( ± ) returns NaN.

__device__ ​ float erfcf ( float  x )

Calculate the complementary error function of the input argument. Calculate the complementary error function of the input argument x, 1 - erf(x).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • erfcf( ) returns 2.
  • erfcf( + ) returns +0.

__device__ ​ float erfcinvf ( float  y )

Calculate the inverse complementary error function of the input argument. Calculate the inverse complementary error function of the input argument y, for y in the interval [0, 2]. The inverse complementary error function find the value x that satisfies the equation y = erfc(x), for 0 y 2 , and x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • erfcinvf(0) returns + .
  • erfcinvf(2) returns .

__device__ ​ float erfcxf ( float  x )

Calculate the scaled complementary error function of the input argument. Calculate the scaled complementary error function of the input argument x, e x 2 erfc ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • erfcxf( - ) returns +
  • erfcxf( + ) returns +0
  • erfcxf(x) returns + if the correctly calculated value is outside the single floating point range.

__device__ ​ float erff ( float  x )

Calculate the error function of the input argument. Calculate the value of the error function for the input argument x, 2 π 0 x e t 2 d t .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • erff( ± 0 ) returns ± 0 .
  • erff( ± ) returns ± 1 .

__device__ ​ float erfinvf ( float  y )

Calculate the inverse error function of the input argument. Calculate the inverse error function of the input argument y, for y in the interval [-1, 1]. The inverse error function finds the value x that satisfies the equation y = erf(x), for 1 y 1 , and x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • erfinvf(1) returns + .
  • erfinvf(-1) returns .

__device__ ​ float exp10f ( float  x )

Calculate the base 10 exponential of the input argument. Calculate the base 10 exponential of the input argument x.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

Returns 10 x .

__device__ ​ float exp2f ( float  x )

Calculate the base 2 exponential of the input argument. Calculate the base 2 exponential of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 2 x .

__device__ ​ float expf ( float  x )

Calculate the base $e$ e exponential of the input argument. Calculate the base e exponential of the input argument x, e x .

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

Returns e x .

__device__ ​ float expm1f ( float  x )

Calculate the base $e$ e exponential of the input argument, minus 1. Calculate the base e exponential of the input argument x, minus 1.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns e x 1 .

__device__ ​ float fabsf ( float  x )

Calculate the absolute value of its argument. Calculate the absolute value of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the absolute value of its argument.

  • fabs( ± ) returns + .
  • fabs( ± 0 ) returns 0.

__device__ ​ float fdimf ( float  x, float  y )

Compute the positive difference between x and y. Compute the positive difference between x and y. The positive difference is x - y when x > y and +0 otherwise.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the positive difference between x and y.

  • fdimf(x, y) returns x - y if x > y.
  • fdimf(x, y) returns +0 if x y.

__device__ ​ float fdividef ( float  x, float  y )

Divide two floating point values. Compute x divided by y. If --use_fast_math is specified, use __fdividef() for higher performance, otherwise use normal division.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

Returns x / y.

__device__ ​ float floorf ( float  x )

Calculate the largest integer less than or equal to x. Calculate the largest integer value which is less than or equal to x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns l o g e ( 1 + x ) expressed as a floating-point number.

  • floorf( ± ) returns ± .
  • floorf( ± 0 ) returns ± 0 .

__device__ ​ float fmaf ( float  x, float  y, float  z )

Compute $x \times y + z$ x×y+z as a single operation. Compute the value of x × y + z as a single ternary operation. After computing the value to infinite precision, the value is rounded once.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact + .
  • fmaf(x, y, + ) returns NaN if x × y is an exact .

__device__ ​ float fmaxf ( float  x, float  y )

Determine the maximum numeric value of the arguments. Determines the maximum numeric value of the arguments x and y. Treats NaN arguments as missing data. If one argument is a NaN and the other is legitimate numeric value, the numeric value is chosen.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the maximum numeric values of the arguments x and y.

  • If both arguments are NaN, returns NaN.
  • If one argument is NaN, returns the numeric argument.

__device__ ​ float fminf ( float  x, float  y )

Determine the minimum numeric value of the arguments. Determines the minimum numeric value of the arguments x and y. Treats NaN arguments as missing data. If one argument is a NaN and the other is legitimate numeric value, the numeric value is chosen.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the minimum numeric values of the arguments x and y.

  • If both arguments are NaN, returns NaN.
  • If one argument is NaN, returns the numeric argument.

__device__ ​ float fmodf ( float  x, float  y )

Calculate the floating-point remainder of x / y. Calculate the floating-point remainder of x / y. The absolute value of the computed value is always less than y's absolute value and will have the same sign as x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • Returns the floating point remainder of x / y.
  • fmodf( ± 0 , y) returns ± 0 if y is not zero.
  • fmodf(x, y) returns NaN and raised an invalid floating point exception if x is ± or y is zero.
  • fmodf(x, y) returns zero if y is zero or the result would overflow.
  • fmodf(x, ± ) returns x if x is finite.
  • fmodf(x, 0) returns NaN.

__device__ ​ float frexpf ( float  x, int* nptr )

Extract mantissa and exponent of a floating-point value. Decomposes the floating-point value x into a component m for the normalized fraction element and another term n for the exponent. The absolute value of m will be greater than or equal to 0.5 and less than 1.0 or it will be equal to 0; x = m 2 n . The integer exponent n will be stored in the location to which nptr points.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the fractional component m.

  • frexp(0, nptr) returns 0 for the fractional component and zero for the integer component.
  • frexp( ± 0 , nptr) returns ± 0 and stores zero in the location pointed to by nptr.
  • frexp( ± , nptr) returns ± and stores an unspecified value in the location to which nptr points.
  • frexp(NaN, y) returns a NaN and stores an unspecified value in the location to which nptr points.

__device__ ​ float hypotf ( float  x, float  y )

Calculate the square root of the sum of squares of two arguments. Calculates the length of the hypotenuse of a right triangle whose two sides have lengths x and y without undue overflow or underflow.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the length of the hypotenuse x 2 + y 2 . If the correct value would overflow, returns + . If the correct value would underflow, returns 0.

__device__ ​ int ilogbf ( float  x )

Compute the unbiased integer exponent of the argument. Calculates the unbiased integer exponent of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • If successful, returns the unbiased exponent of the argument.
  • ilogbf(0) returns INT_MIN.
  • ilogbf(NaN) returns NaN.
  • ilogbf(x) returns INT_MAX if x is or the correct value is greater than INT_MAX.
  • ilogbf(x) return INT_MIN if the correct value is less than INT_MIN.

__device__ ​ int isfinite ( float  a )

Determine whether argument is finite. Determine whether the floating-point value a is a finite value (zero, subnormal, or normal and not infinity or NaN).

Returns

Returns a nonzero value if and only if a is a finite value.

__device__ ​ int isinf ( float  a )

Determine whether argument is infinite. Determine whether the floating-point value a is an infinite value (positive or negative).

Returns

Returns a nonzero value if and only if a is a infinite value.

__device__ ​ int isnan ( float  a )

Determine whether argument is a NaN. Determine whether the floating-point value a is a NaN.

Returns

Returns a nonzero value if and only if a is a NaN value.

__device__ ​ float j0f ( float  x )

Calculate the value of the Bessel function of the first kind of order 0 for the input argument. Calculate the value of the Bessel function of the first kind of order 0 for the input argument x, J 0 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the value of the Bessel function of the first kind of order 0.

  • j0f( ± ) returns +0.
  • j0f(NaN) returns NaN.

__device__ ​ float j1f ( float  x )

Calculate the value of the Bessel function of the first kind of order 1 for the input argument. Calculate the value of the Bessel function of the first kind of order 1 for the input argument x, J 1 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the value of the Bessel function of the first kind of order 1.

  • j1f( ± 0 ) returns ± 0 .
  • j1f( ± ) returns +0.
  • j1f(NaN) returns NaN.

__device__ ​ float jnf ( int  n, float  x )

Calculate the value of the Bessel function of the first kind of order n for the input argument. Calculate the value of the Bessel function of the first kind of order n for the input argument x, J n ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the value of the Bessel function of the first kind of order n.

  • jnf(n, NaN) returns NaN.
  • jnf(n, x) returns NaN for n < 0.
  • jnf(n, + ) returns +0.

__device__ ​ float ldexpf ( float  x, int  exp )

Calculate the value of $x\cdot 2^{exp}$ x⋅2exp. Calculate the value of x 2 e x p of the input arguments x and exp.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • ldexpf(x) returns ± if the correctly calculated value is outside the single floating point range.

__device__ ​ float lgammaf ( float  x )

Calculate the natural logarithm of the absolute value of the gamma function of the input argument. Calculate the natural logarithm of the absolute value of the gamma function of the input argument x, namely the value of l o g e |   0 e t t x 1 d t | .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • lgammaf(1) returns +0.
  • lgammaf(2) returns +0.
  • lgammaf(x) returns ± if the correctly calculated value is outside the single floating point range.
  • lgammaf(x) returns + if x 0.
  • lgammaf( ) returns .
  • lgammaf( + ) returns + .

__device__ ​ long long int llrintf ( float  x )

Round input to nearest integer value. Round x to the nearest integer value, with halfway cases rounded towards zero. If the result is outside the range of the return type, the result is undefined.

Returns

Returns rounded integer value.

__device__ ​ long long int llroundf ( float  x )

Round to nearest integer value. Round x to the nearest integer value, with halfway cases rounded away from zero. If the result is outside the range of the return type, the result is undefined.

Note:

This function may be slower than alternate rounding methods. See llrintf().

Returns

Returns rounded integer value.

__device__ ​ float log10f ( float  x )

Calculate the base 10 logarithm of the input argument. Calculate the base 10 logarithm of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • log10f( ± 0 ) returns .
  • log10f(1) returns +0.
  • log10f(x) returns NaN for x < 0.
  • log10f( + ) returns + .

__device__ ​ float log1pf ( float  x )

Calculate the value of $log_{e}(1+x)$ $\lfloor x \rfloor$ loge(1+x). Calculate the value of l o g e ( 1 + x ) of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • log1pf( ± 0 ) returns .
  • log1pf(-1) returns +0.
  • log1pf(x) returns NaN for x < -1.
  • log1pf( + ) returns + .

__device__ ​ float log2f ( float  x )

Calculate the base 2 logarithm of the input argument. Calculate the base 2 logarithm of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • log2f( ± 0 ) returns .
  • log2f(1) returns +0.
  • log2f(x) returns NaN for x < 0.
  • log2f( + ) returns + .

__device__ ​ float logbf ( float  x )

Calculate the floating point representation of the exponent of the input argument. Calculate the floating point representation of the exponent of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • logbf ± 0 returns
  • logbf + returns +

__device__ ​ float logf ( float  x )

Calculate the natural logarithm of the input argument. Calculate the natural logarithm of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • logf( ± 0 ) returns .
  • logf(1) returns +0.
  • logf(x) returns NaN for x < 0.
  • logf( + ) returns + .

__device__ ​ long int lrintf ( float  x )

Round input to nearest integer value. Round x to the nearest integer value, with halfway cases rounded towards zero. If the result is outside the range of the return type, the result is undefined.

Returns

Returns rounded integer value.

__device__ ​ long int lroundf ( float  x )

Round to nearest integer value. Round x to the nearest integer value, with halfway cases rounded away from zero. If the result is outside the range of the return type, the result is undefined.

Note:

This function may be slower than alternate rounding methods. See lrintf().

Returns

Returns rounded integer value.

__device__ ​ float modff ( float  x, float* iptr )

Break down the input argument into fractional and integral parts. Break down the argument x into fractional and integral parts. The integral part is stored in the argument iptr. Fractional and integral parts are given the same sign as the argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • modff( ± x , iptr) returns a result with the same sign as x.
  • modff( ± , iptr) returns ± 0 and stores ± in the object pointed to by iptr.
  • modff(NaN, iptr) stores a NaN in the object pointed to by iptr and returns a NaN.

__device__ ​ float nanf ( const char* tagp )

Returns "Not a Number" value. Return a representation of a quiet NaN. Argument tagp selects one of the possible representations.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • nanf(tagp) returns NaN.

__device__ ​ float nearbyintf ( float  x )

Round the input argument to the nearest integer. Round argument x to an integer value in single precision floating-point format.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • nearbyintf( ± 0 ) returns ± 0 .
  • nearbyintf( ± ) returns ± .

__device__ ​ float nextafterf ( float  x, float  y )

Return next representable single-precision floating-point value afer argument. Calculate the next representable single-precision floating-point value following x in the direction of y. For example, if y is greater than x, nextafterf() returns the smallest representable number greater than x

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • nextafterf( ± , y) returns ± .

__device__ ​ float normcdff ( float  y )

Calculate the standard normal cumulative distribution function. Calculate the cumulative distribution function of the standard normal distribution for input argument y, Φ ( y ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • normcdff( + ) returns 1
  • normcdff( ) returns +0

__device__ ​ float normcdfinvf ( float  y )

Calculate the inverse of the standard normal cumulative distribution function. Calculate the inverse of the standard normal cumulative distribution function for input argument y, Φ 1 ( y ) . The function is defined for input values in the interval ( 0 , 1 ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • normcdfinvf(0) returns .
  • normcdfinvf(1) returns + .
  • normcdfinvf(x) returns NaN if x is not in the interval [0,1].

__device__ ​ float powf ( float  x, float  y )

Calculate the value of first argument to the power of second argument. Calculate the value of x to the power of y.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • powf( ± 0 , y) returns ± for y an integer less than 0.
  • powf( ± 0 , y) returns ± 0 for y an odd integer greater than 0.
  • powf( ± 0 , y) returns +0 for y > 0 and not and odd integer.
  • powf(-1, ± ) returns 1.
  • powf(+1, y) returns 1 for any y, even a NaN.
  • powf(x, ± 0 ) returns 1 for any x, even a NaN.
  • powf(x, y) returns a NaN for finite x < 0 and finite non-integer y.
  • powf(x, ) returns + for | x | < 1 .
  • powf(x, ) returns +0 for | x | > 1 .
  • powf(x, + ) returns +0 for | x | < 1 .
  • powf(x, + ) returns + for | x | > 1 .
  • powf( , y) returns -0 for y an odd integer less than 0.
  • powf( , y) returns +0 for y < 0 and not an odd integer.
  • powf( , y) returns for y an odd integer greater than 0.
  • powf( , y) returns + for y > 0 and not an odd integer.
  • powf( + , y) returns +0 for y < 0.
  • powf( + , y) returns + for y > 0.

__device__ ​ float rcbrtf ( float  x )

Calculate reciprocal cube root function. Calculate reciprocal cube root function of x

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • rcbrt( ± 0 ) returns ± .
  • rcbrt( ± ) returns ± 0 .

__device__ ​ float remainderf ( float  x, float  y )

Compute single-precision floating-point remainder. Compute single-precision floating-point remainder r of dividing x by y for nonzero y. Thus r = x n y . The value n is the integer value nearest x y . In the case when | n x y | = 1 2 , the even n value is chosen.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • remainderf(x, 0) returns NaN.
  • remainderf( ± , y) returns NaN.
  • remainderf(x, ± ) returns x for finite x.

__device__ ​ float remquof ( float  x, float  y, int* quo )

Compute single-precision floating-point remainder and part of quotient. Compute a double-precision floating-point remainder in the same way as the remainderf() function. Argument quo returns part of quotient upon division of x by y. Value quo has the same sign as x y and may not be the exact quotient but agrees with the exact quotient in the low order 3 bits.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the remainder.

  • remquof(x, 0, quo) returns NaN.
  • remquof( ± , y, quo) returns NaN.
  • remquof(x, ± , quo) returns x.

__device__ ​ float rintf ( float  x )

Round input to nearest integer value in floating-point. Round x to the nearest integer value in floating-point format, with halfway cases rounded towards zero.

Returns

Returns rounded integer value.

__device__ ​ float roundf ( float  x )

Round to nearest integer value in floating-point. Round x to the nearest integer value in floating-point format, with halfway cases rounded away from zero.

Note:

This function may be slower than alternate rounding methods. See rintf().

Returns

Returns rounded integer value.

__device__ ​ float rsqrtf ( float  x )

Calculate the reciprocal of the square root of the input argument. Calculate the reciprocal of the nonnegative square root of x, 1 / x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 1 / x .

  • rsqrtf( + ) returns +0.
  • rsqrtf( ± 0 ) returns ± .
  • rsqrtf(x) returns NaN if x is less than 0.

__device__ ​ float scalblnf ( float  x, long int  n )

Scale floating-point input by integer power of two. Scale x by 2 n by efficient manipulation of the floating-point exponent.

Returns

Returns x * 2 n .

  • scalblnf( ± 0 , n) returns ± 0 .
  • scalblnf(x, 0) returns x.
  • scalblnf( ± , n) returns ± .

__device__ ​ float scalbnf ( float  x, int  n )

Scale floating-point input by integer power of two. Scale x by 2 n by efficient manipulation of the floating-point exponent.

Returns

Returns x * 2 n .

  • scalbnf( ± 0 , n) returns ± 0 .
  • scalbnf(x, 0) returns x.
  • scalbnf( ± , n) returns ± .

__device__ ​ int signbit ( float  a )

Return the sign bit of the input. Determine whether the floating-point value a is negative.

Returns

Returns a nonzero value if and only if a is negative. Reports the sign bit of all values including infinities, zeros, and NaNs.

__device__ ​ void sincosf ( float  x, float* sptr, float* cptr )

Calculate the sine and cosine of the first input argument. Calculate the sine and cosine of the first input argument x (measured in radians). The results for sine and cosine are written into the second argument, sptr, and, respectively, third argument, cptr.

See also:

sinf() and cosf().

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

  • none

__device__ ​ void sincospif ( float  x, float* sptr, float* cptr )

Calculate the sine and cosine of the first input argument $\times \pi$ ×π. Calculate the sine and cosine of the first input argument, x (measured in radians), × π . The results for sine and cosine are written into the second argument, sptr, and, respectively, third argument, cptr.

See also:

sinpif() and cospif().

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • none

__device__ ​ float sinf ( float  x )

Calculate the sine of the input argument. Calculate the sine of the input argument x (measured in radians).

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

  • sinf( ± 0 ) returns ± 0 .
  • sinf( ± ) returns NaN.

__device__ ​ float sinhf ( float  x )

Calculate the hyperbolic sine of the input argument. Calculate the hyperbolic sine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • sinhf( ± 0 ) returns ± 0 .
  • sinhf( ± ) returns NaN.

__device__ ​ float sinpif ( float  x )

Calculate the sine of the input argument $\times \pi$ ×π. Calculate the sine of x × π (measured in radians), where x is the input argument.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • sinpif( ± 0 ) returns ± 0 .
  • sinpif( ± ) returns NaN.

__device__ ​ float sqrtf ( float  x )

Calculate the square root of the input argument. Calculate the nonnegative square root of x, x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x .

  • sqrtf( ± 0 ) returns ± 0 .
  • sqrtf( + ) returns + .
  • sqrtf(x) returns NaN if x is less than 0.

__device__ ​ float tanf ( float  x )

Calculate the tangent of the input argument. Calculate the tangent of the input argument x (measured in radians).

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This function is affected by the --use_fast_math compiler flag. See the CUDA C Programming Guide, Appendix C, Table C-3 for a complete list of functions affected.

Returns

  • tanf( ± 0 ) returns ± 0 .
  • tanf( ± ) returns NaN.

__device__ ​ float tanhf ( float  x )

Calculate the hyperbolic tangent of the input argument. Calculate the hyperbolic tangent of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • tanhf( ± 0 ) returns ± 0 .

__device__ ​ float tgammaf ( float  x )

Calculate the gamma function of the input argument. Calculate the gamma function of the input argument x, namely the value of 0 e t t x 1 d t .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

  • tgammaf( ± 0 ) returns ± .
  • tgammaf(2) returns +0.
  • tgammaf(x) returns ± if the correctly calculated value is outside the single floating point range.
  • tgammaf(x) returns NaN if x < 0.
  • tgammaf( ) returns NaN.
  • tgammaf( + ) returns + .

__device__ ​ float truncf ( float  x )

Truncate input argument to the integral part. Round x to the nearest integer value that does not exceed x in magnitude.

Returns

Returns truncated integer value.

__device__ ​ float y0f ( float  x )

Calculate the value of the Bessel function of the second kind of order 0 for the input argument. Calculate the value of the Bessel function of the second kind of order 0 for the input argument x, Y 0 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the value of the Bessel function of the second kind of order 0.

  • y0f(0) returns .
  • y0f(x) returns NaN for x < 0.
  • y0f( + ) returns +0.
  • y0f(NaN) returns NaN.

__device__ ​ float y1f ( float  x )

Calculate the value of the Bessel function of the second kind of order 1 for the input argument. Calculate the value of the Bessel function of the second kind of order 1 for the input argument x, Y 1 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the value of the Bessel function of the second kind of order 1.

  • y1f(0) returns .
  • y1f(x) returns NaN for x < 0.
  • y1f( + ) returns +0.
  • y1f(NaN) returns NaN.

__device__ ​ float ynf ( int  n, float  x )

Calculate the value of the Bessel function of the second kind of order n for the input argument. Calculate the value of the Bessel function of the second kind of order n for the input argument x, Y n ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the value of the Bessel function of the second kind of order n.

  • ynf(n, x) returns NaN for n < 0.
  • ynf(n, 0) returns .
  • ynf(n, x) returns NaN for x < 0.
  • ynf(n, + ) returns +0.
  • ynf(n, NaN) returns NaN.

Double Precision Mathematical Functions

Description

This section describes double precision mathematical functions.

Functions

__device__ ​ double acos ( double  x )
Calculate the arc cosine of the input argument.
__device__ ​ double acosh ( double  x )
Calculate the nonnegative arc hyperbolic cosine of the input argument.
__device__ ​ double asin ( double  x )
Calculate the arc sine of the input argument.
__device__ ​ double asinh ( double  x )
Calculate the arc hyperbolic sine of the input argument.
__device__ ​ double atan ( double  x )
Calculate the arc tangent of the input argument.
__device__ ​ double atan2 ( double  x, double  y )
Calculate the arc tangent of the ratio of first and second input arguments.
__device__ ​ double atanh ( double  x )
Calculate the arc hyperbolic tangent of the input argument.
__device__ ​ double cbrt ( double  x )
Calculate the cube root of the input argument.
__device__ ​ double ceil ( double  x )
Calculate ceiling of the input argument.
__device__ ​ double copysign ( double  x, double  y )
Create value with given magnitude, copying sign of second value.
__device__ ​ double cos ( double  x )
Calculate the cosine of the input argument.
__device__ ​ double cosh ( double  x )
Calculate the hyperbolic cosine of the input argument.
__device__ ​ double cospi ( double  x )
Calculate the cosine of the input argument $\times \pi$ ×π.
__device__ ​ double erf ( double  x )
Calculate the error function of the input argument.
__device__ ​ double erfc ( double  x )
Calculate the complementary error function of the input argument.
__device__ ​ double erfcinv ( double  y )
Calculate the inverse complementary error function of the input argument.
__device__ ​ double erfcx ( double  x )
Calculate the scaled complementary error function of the input argument.
__device__ ​ double erfinv ( double  y )
Calculate the inverse error function of the input argument.
__device__ ​ double exp ( double  x )
Calculate the base $e$ e exponential of the input argument.
__device__ ​ double exp10 ( double  x )
Calculate the base 10 exponential of the input argument.
__device__ ​ double exp2 ( double  x )
Calculate the base 2 exponential of the input argument.
__device__ ​ double expm1 ( double  x )
Calculate the base $e$ e exponential of the input argument, minus 1.
__device__ ​ double fabs ( double  x )
Calculate the absolute value of the input argument.
__device__ ​ double fdim ( double  x, double  y )
Compute the positive difference between x and y.
__device__ ​ double floor ( double  x )
Calculate the largest integer less than or equal to x.
__device__ ​ double fma ( double  x, double  y, double  z )
Compute $x \times y + z$ x×y+z as a single operation.
__device__ ​ double fmax ( double , double )
Determine the maximum numeric value of the arguments.
__device__ ​ double fmin ( double  x, double  y )
Determine the minimum numeric value of the arguments.
__device__ ​ double fmod ( double  x, double  y )
Calculate the floating-point remainder of x / y.
__device__ ​ double frexp ( double  x, int* nptr )
Extract mantissa and exponent of a floating-point value.
__device__ ​ double hypot ( double  x, double  y )
Calculate the square root of the sum of squares of two arguments.
__device__ ​ int ilogb ( double  x )
Compute the unbiased integer exponent of the argument.
__device__ ​ int isfinite ( double  a )
Determine whether argument is finite.
__device__ ​ int isinf ( double  a )
Determine whether argument is infinite.
__device__ ​ int isnan ( double  a )
Determine whether argument is a NaN.
__device__ ​ double j0 ( double  x )
Calculate the value of the Bessel function of the first kind of order 0 for the input argument.
__device__ ​ double j1 ( double  x )
Calculate the value of the Bessel function of the first kind of order 1 for the input argument.
__device__ ​ double jn ( int  n, double  x )
Calculate the value of the Bessel function of the first kind of order n for the input argument.
__device__ ​ double ldexp ( double  x, int  exp )
Calculate the value of $x\cdot 2^{exp}$ x⋅2exp.
__device__ ​ double lgamma ( double  x )
Calculate the natural logarithm of the absolute value of the gamma function of the input argument.
__device__ ​ long long int llrint ( double  x )
Round input to nearest integer value.
__device__ ​ long long int llround ( double  x )
Round to nearest integer value.
__device__ ​ double log ( double  x )
Calculate the base $e$ e logarithm of the input argument.
__device__ ​ double log10 ( double  x )
Calculate the base 10 logarithm of the input argument.
__device__ ​ double log1p ( double  x )
Calculate the value of $log_{e}(1+x)$ $\lfloor x \rfloor$ loge(1+x).
__device__ ​ double log2 ( double  x )
Calculate the base 2 logarithm of the input argument.
__device__ ​ double logb ( double  x )
Calculate the floating point representation of the exponent of the input argument.
__device__ ​ long int lrint ( double  x )
Round input to nearest integer value.
__device__ ​ long int lround ( double  x )
Round to nearest integer value.
__device__ ​ double modf ( double  x, double* iptr )
Break down the input argument into fractional and integral parts.
__device__ ​ double nan ( const char* tagp )
Returns "Not a Number" value.
__device__ ​ double nearbyint ( double  x )
Round the input argument to the nearest integer.
__device__ ​ double nextafter ( double  x, double  y )
Return next representable double-precision floating-point value after argument.
__device__ ​ double normcdf ( double  y )
Calculate the standard normal cumulative distribution function.
__device__ ​ double normcdfinv ( double  y )
Calculate the inverse of the standard normal cumulative distribution function.
__device__ ​ double pow ( double  x, double  y )
Calculate the value of first argument to the power of second argument.
__device__ ​ double rcbrt ( double  x )
Calculate reciprocal cube root function.
__device__ ​ double remainder ( double  x, double  y )
Compute double-precision floating-point remainder.
__device__ ​ double remquo ( double  x, double  y, int* quo )
Compute double-precision floating-point remainder and part of quotient.
__device__ ​ double rint ( double  x )
Round to nearest integer value in floating-point.
__device__ ​ double round ( double  x )
Round to nearest integer value in floating-point.
__device__ ​ double rsqrt ( double  x )
Calculate the reciprocal of the square root of the input argument.
__device__ ​ double scalbln ( double  x, long int  n )
Scale floating-point input by integer power of two.
__device__ ​ double scalbn ( double  x, int  n )
Scale floating-point input by integer power of two.
__device__ ​ int signbit ( double  a )
Return the sign bit of the input.
__device__ ​ double sin ( double  x )
Calculate the sine of the input argument.
__device__ ​ void sincos ( double  x, double* sptr, double* cptr )
Calculate the sine and cosine of the first input argument.
__device__ ​ void sincospi ( double  x, double* sptr, double* cptr )
Calculate the sine and cosine of the first input argument $\times \pi$ ×π.
__device__ ​ double sinh ( double  x )
Calculate the hyperbolic sine of the input argument.
__device__ ​ double sinpi ( double  x )
Calculate the sine of the input argument $\times \pi$ ×π.
__device__ ​ double sqrt ( double  x )
Calculate the square root of the input argument.
__device__ ​ double tan ( double  x )
Calculate the tangent of the input argument.
__device__ ​ double tanh ( double  x )
Calculate the hyperbolic tangent of the input argument.
__device__ ​ double tgamma ( double  x )
Calculate the gamma function of the input argument.
__device__ ​ double trunc ( double  x )
Truncate input argument to the integral part.
__device__ ​ double y0 ( double  x )
Calculate the value of the Bessel function of the second kind of order 0 for the input argument.
__device__ ​ double y1 ( double  x )
Calculate the value of the Bessel function of the second kind of order 1 for the input argument.
__device__ ​ double yn ( int  n, double  x )
Calculate the value of the Bessel function of the second kind of order n for the input argument.

Functions

__device__ ​ double acos ( double  x )

Calculate the arc cosine of the input argument. Calculate the principal value of the arc cosine of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Result will be in radians, in the interval [0, π ] for x inside [-1, +1].

  • acos(1) returns +0.
  • acos(x) returns NaN for x outside [-1, +1].

__device__ ​ double acosh ( double  x )

Calculate the nonnegative arc hyperbolic cosine of the input argument. Calculate the nonnegative arc hyperbolic cosine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Result will be in the interval [0, + ].

  • acosh(1) returns 0.
  • acosh(x) returns NaN for x in the interval [ , 1).

__device__ ​ double asin ( double  x )

Calculate the arc sine of the input argument. Calculate the principal value of the arc sine of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Result will be in radians, in the interval [- π /2, + π /2] for x inside [-1, +1].

  • asin(0) returns +0.
  • asin(x) returns NaN for x outside [-1, +1].

__device__ ​ double asinh ( double  x )

Calculate the arc hyperbolic sine of the input argument. Calculate the arc hyperbolic sine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • asinh(0) returns 1.

__device__ ​ double atan ( double  x )

Calculate the arc tangent of the input argument. Calculate the principal value of the arc tangent of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Result will be in radians, in the interval [- π /2, + π /2].

  • atan(0) returns +0.

__device__ ​ double atan2 ( double  x, double  y )

Calculate the arc tangent of the ratio of first and second input arguments. Calculate the principal value of the arc tangent of the ratio of first and second input arguments x / y. The quadrant of the result is determined by the signs of inputs x and y.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Result will be in radians, in the interval [- π /, + π ].

  • atan2(0, 1) returns +0.

__device__ ​ double atanh ( double  x )

Calculate the arc hyperbolic tangent of the input argument. Calculate the arc hyperbolic tangent of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • atanh( ± 0 ) returns ± 0 .
  • atanh( ± 1 ) returns ± .
  • atanh(x) returns NaN for x outside interval [-1, 1].

__device__ ​ double cbrt ( double  x )

Calculate the cube root of the input argument. Calculate the cube root of x, x 1 / 3 .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns x 1 / 3 .

  • cbrt( ± 0 ) returns ± 0 .
  • cbrt( ± ) returns ± .

__device__ ​ double ceil ( double  x )

Calculate ceiling of the input argument. Compute the smallest integer value not less than x.

Returns

Returns x expressed as a floating-point number.

  • ceil( ± 0 ) returns ± 0 .
  • ceil( ± ) returns ± .

__device__ ​ double copysign ( double  x, double  y )

Create value with given magnitude, copying sign of second value. Create a floating-point value with the magnitude x and the sign of y.

Returns

Returns a value with the magnitude of x and the sign of y.

__device__ ​ double cos ( double  x )

Calculate the cosine of the input argument. Calculate the cosine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • cos( ± 0 ) returns 1.
  • cos( ± ) returns NaN.

__device__ ​ double cosh ( double  x )

Calculate the hyperbolic cosine of the input argument. Calculate the hyperbolic cosine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • cosh(0) returns 1.
  • cosh( ± ) returns + .

__device__ ​ double cospi ( double  x )

Calculate the cosine of the input argument $\times \pi$ ×π. Calculate the cosine of x × π (measured in radians), where x is the input argument.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • cospi( ± 0 ) returns 1.
  • cospi( ± ) returns NaN.

__device__ ​ double erf ( double  x )

Calculate the error function of the input argument. Calculate the value of the error function for the input argument x, 2 π 0 x e t 2 d t .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • erf( ± 0 ) returns ± 0 .
  • erf( ± ) returns ± 1 .

__device__ ​ double erfc ( double  x )

Calculate the complementary error function of the input argument. Calculate the complementary error function of the input argument x, 1 - erf(x).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • erfc( ) returns 2.
  • erfc( + ) returns +0.

__device__ ​ double erfcinv ( double  y )

Calculate the inverse complementary error function of the input argument. Calculate the inverse complementary error function of the input argument y, for y in the interval [0, 2]. The inverse complementary error function find the value x that satisfies the equation y = erfc(x), for 0 y 2 , and x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • erfcinv(0) returns + .
  • erfcinv(2) returns .

__device__ ​ double erfcx ( double  x )

Calculate the scaled complementary error function of the input argument. Calculate the scaled complementary error function of the input argument x, e x 2 erfc ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • erfcx( - ) returns +
  • erfcx( + ) returns +0
  • erfcx(x) returns + if the correctly calculated value is outside the double floating point range.

__device__ ​ double erfinv ( double  y )

Calculate the inverse error function of the input argument. Calculate the inverse error function of the input argument y, for y in the interval [-1, 1]. The inverse error function finds the value x that satisfies the equation y = erf(x), for 1 y 1 , and x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • erfinv(1) returns + .
  • erfinv(-1) returns .

__device__ ​ double exp ( double  x )

Calculate the base $e$ e exponential of the input argument. Calculate the base e exponential of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns e x .

__device__ ​ double exp10 ( double  x )

Calculate the base 10 exponential of the input argument. Calculate the base 10 exponential of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns 10 x .

__device__ ​ double exp2 ( double  x )

Calculate the base 2 exponential of the input argument. Calculate the base 2 exponential of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns 2 x .

__device__ ​ double expm1 ( double  x )

Calculate the base $e$ e exponential of the input argument, minus 1. Calculate the base e exponential of the input argument x, minus 1.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns e x 1 .

__device__ ​ double fabs ( double  x )

Calculate the absolute value of the input argument. Calculate the absolute value of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the absolute value of the input argument.

  • fabs( ± ) returns + .
  • fabs( ± 0 ) returns 0.

__device__ ​ double fdim ( double  x, double  y )

Compute the positive difference between x and y. Compute the positive difference between x and y. The positive difference is x - y when x > y and +0 otherwise.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the positive difference between x and y.

  • fdim(x, y) returns x - y if x > y.
  • fdim(x, y) returns +0 if x y.

__device__ ​ double floor ( double  x )

Calculate the largest integer less than or equal to x. Calculates the largest integer value which is less than or equal to x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns l o g e ( 1 + x ) expressed as a floating-point number.

  • floor( ± ) returns ± .
  • floor( ± 0 ) returns ± 0 .

__device__ ​ double fma ( double  x, double  y, double  z )

Compute $x \times y + z$ x×y+z as a single operation. Compute the value of x × y + z as a single ternary operation. After computing the value to infinite precision, the value is rounded once.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fma( ± , ± 0 , z) returns NaN.
  • fma( ± 0 , ± , z) returns NaN.
  • fma(x, y, ) returns NaN if x × y is an exact + .
  • fma(x, y, + ) returns NaN if x × y is an exact .

__device__ ​ double fmax ( double , double )

Determine the maximum numeric value of the arguments. Determines the maximum numeric value of the arguments x and y. Treats NaN arguments as missing data. If one argument is a NaN and the other is legitimate numeric value, the numeric value is chosen.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the maximum numeric values of the arguments x and y.

  • If both arguments are NaN, returns NaN.
  • If one argument is NaN, returns the numeric argument.

__device__ ​ double fmin ( double  x, double  y )

Determine the minimum numeric value of the arguments. Determines the minimum numeric value of the arguments x and y. Treats NaN arguments as missing data. If one argument is a NaN and the other is legitimate numeric value, the numeric value is chosen.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the minimum numeric values of the arguments x and y.

  • If both arguments are NaN, returns NaN.
  • If one argument is NaN, returns the numeric argument.

__device__ ​ double fmod ( double  x, double  y )

Calculate the floating-point remainder of x / y. Calculate the floating-point remainder of x / y. The absolute value of the computed value is always less than y's absolute value and will have the same sign as x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • Returns the floating point remainder of x / y.
  • fmod( ± 0 , y) returns ± 0 if y is not zero.
  • fmod(x, y) returns NaN and raised an invalid floating point exception if x is ± or y is zero.
  • fmod(x, y) returns zero if y is zero or the result would overflow.
  • fmod(x, ± ) returns x if x is finite.
  • fmod(x, 0) returns NaN.

__device__ ​ double frexp ( double  x, int* nptr )

Extract mantissa and exponent of a floating-point value. Decompose the floating-point value x into a component m for the normalized fraction element and another term n for the exponent. The absolute value of m will be greater than or equal to 0.5 and less than 1.0 or it will be equal to 0; x = m 2 n . The integer exponent n will be stored in the location to which nptr points.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the fractional component m.

  • frexp(0, nptr) returns 0 for the fractional component and zero for the integer component.
  • frexp( ± 0 , nptr) returns ± 0 and stores zero in the location pointed to by nptr.
  • frexp( ± , nptr) returns ± and stores an unspecified value in the location to which nptr points.
  • frexp(NaN, y) returns a NaN and stores an unspecified value in the location to which nptr points.

__device__ ​ double hypot ( double  x, double  y )

Calculate the square root of the sum of squares of two arguments. Calculate the length of the hypotenuse of a right triangle whose two sides have lengths x and y without undue overflow or underflow.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the length of the hypotenuse x 2 + y 2 . If the correct value would overflow, returns + . If the correct value would underflow, returns 0.

__device__ ​ int ilogb ( double  x )

Compute the unbiased integer exponent of the argument. Calculates the unbiased integer exponent of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • If successful, returns the unbiased exponent of the argument.
  • ilogb(0) returns INT_MIN.
  • ilogb(NaN) returns NaN.
  • ilogb(x) returns INT_MAX if x is or the correct value is greater than INT_MAX.
  • ilogb(x) return INT_MIN if the correct value is less than INT_MIN.

__device__ ​ int isfinite ( double  a )

Determine whether argument is finite. Determine whether the floating-point value a is a finite value (zero, subnormal, or normal and not infinity or NaN).

Returns

Returns a nonzero value if and only if a is a finite value.

__device__ ​ int isinf ( double  a )

Determine whether argument is infinite. Determine whether the floating-point value a is an infinite value (positive or negative).

Returns

Returns a nonzero value if and only if a is a infinite value.

__device__ ​ int isnan ( double  a )

Determine whether argument is a NaN. Determine whether the floating-point value a is a NaN.

Returns

Returns a nonzero value if and only if a is a NaN value.

__device__ ​ double j0 ( double  x )

Calculate the value of the Bessel function of the first kind of order 0 for the input argument. Calculate the value of the Bessel function of the first kind of order 0 for the input argument x, J 0 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the value of the Bessel function of the first kind of order 0.

  • j0( ± ) returns +0.
  • j0(NaN) returns NaN.

__device__ ​ double j1 ( double  x )

Calculate the value of the Bessel function of the first kind of order 1 for the input argument. Calculate the value of the Bessel function of the first kind of order 1 for the input argument x, J 1 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the value of the Bessel function of the first kind of order 1.

  • j1( ± 0 ) returns ± 0 .
  • j1( ± ) returns +0.
  • j1(NaN) returns NaN.

__device__ ​ double jn ( int  n, double  x )

Calculate the value of the Bessel function of the first kind of order n for the input argument. Calculate the value of the Bessel function of the first kind of order n for the input argument x, J n ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the value of the Bessel function of the first kind of order n.

  • jn(n, NaN) returns NaN.
  • jn(n, x) returns NaN for n < 0.
  • jn(n, + ) returns +0.

__device__ ​ double ldexp ( double  x, int  exp )

Calculate the value of $x\cdot 2^{exp}$ x⋅2exp. Calculate the value of x 2 e x p of the input arguments x and exp.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • ldexp(x) returns ± if the correctly calculated value is outside the double floating point range.

__device__ ​ double lgamma ( double  x )

Calculate the natural logarithm of the absolute value of the gamma function of the input argument. Calculate the natural logarithm of the absolute value of the gamma function of the input argument x, namely the value of log e 0 e t t x 1 d t

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • lgamma(1) returns +0.
  • lgamma(2) returns +0.
  • lgamma(x) returns ± if the correctly calculated value is outside the double floating point range.
  • lgamma(x) returns + if x 0.
  • lgamma( ) returns .
  • lgamma( + ) returns + .

__device__ ​ long long int llrint ( double  x )

Round input to nearest integer value. Round x to the nearest integer value, with halfway cases rounded towards zero. If the result is outside the range of the return type, the result is undefined.

Returns

Returns rounded integer value.

__device__ ​ long long int llround ( double  x )

Round to nearest integer value. Round x to the nearest integer value, with halfway cases rounded away from zero. If the result is outside the range of the return type, the result is undefined.

Note:

This function may be slower than alternate rounding methods. See llrint().

Returns

Returns rounded integer value.

__device__ ​ double log ( double  x )

Calculate the base $e$ e logarithm of the input argument. Calculate the base e logarithm of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • log( ± 0 ) returns .
  • log(1) returns +0.
  • log(x) returns NaN for x < 0.
  • log( + ) returns +

__device__ ​ double log10 ( double  x )

Calculate the base 10 logarithm of the input argument. Calculate the base 10 logarithm of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • log10( ± 0 ) returns .
  • log10(1) returns +0.
  • log10(x) returns NaN for x < 0.
  • log10( + ) returns + .

__device__ ​ double log1p ( double  x )

Calculate the value of $log_{e}(1+x)$ $\lfloor x \rfloor$ loge(1+x). Calculate the value of l o g e ( 1 + x ) of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • log1p( ± 0 ) returns .
  • log1p(-1) returns +0.
  • log1p(x) returns NaN for x < -1.
  • log1p( + ) returns + .

__device__ ​ double log2 ( double  x )

Calculate the base 2 logarithm of the input argument. Calculate the base 2 logarithm of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • log2( ± 0 ) returns .
  • log2(1) returns +0.
  • log2(x) returns NaN for x < 0.
  • log2( + ) returns + .

__device__ ​ double logb ( double  x )

Calculate the floating point representation of the exponent of the input argument. Calculate the floating point representation of the exponent of the input argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • logb ± 0 returns
  • logb ± returns +

__device__ ​ long int lrint ( double  x )

Round input to nearest integer value. Round x to the nearest integer value, with halfway cases rounded towards zero. If the result is outside the range of the return type, the result is undefined.

Returns

Returns rounded integer value.

__device__ ​ long int lround ( double  x )

Round to nearest integer value. Round x to the nearest integer value, with halfway cases rounded away from zero. If the result is outside the range of the return type, the result is undefined.

Note:

This function may be slower than alternate rounding methods. See lrint().

Returns

Returns rounded integer value.

__device__ ​ double modf ( double  x, double* iptr )

Break down the input argument into fractional and integral parts. Break down the argument x into fractional and integral parts. The integral part is stored in the argument iptr. Fractional and integral parts are given the same sign as the argument x.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • modf( ± x , iptr) returns a result with the same sign as x.
  • modf( ± , iptr) returns ± 0 and stores ± in the object pointed to by iptr.
  • modf(NaN, iptr) stores a NaN in the object pointed to by iptr and returns a NaN.

__device__ ​ double nan ( const char* tagp )

Returns "Not a Number" value. Return a representation of a quiet NaN. Argument tagp selects one of the possible representations.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • nan(tagp) returns NaN.

__device__ ​ double nearbyint ( double  x )

Round the input argument to the nearest integer. Round argument x to an integer value in double precision floating-point format.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • nearbyint( ± 0 ) returns ± 0 .
  • nearbyint( ± ) returns ± .

__device__ ​ double nextafter ( double  x, double  y )

Return next representable double-precision floating-point value after argument. Calculate the next representable double-precision floating-point value following x in the direction of y. For example, if y is greater than x, nextafter() returns the smallest representable number greater than x

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • nextafter( ± , y) returns ± .

__device__ ​ double normcdf ( double  y )

Calculate the standard normal cumulative distribution function. Calculate the cumulative distribution function of the standard normal distribution for input argument y, Φ ( y ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • normcdf( + ) returns 1
  • normcdf( ) returns +0

__device__ ​ double normcdfinv ( double  y )

Calculate the inverse of the standard normal cumulative distribution function. Calculate the inverse of the standard normal cumulative distribution function for input argument y, Φ 1 ( y ) . The function is defined for input values in the interval ( 0 , 1 ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • normcdfinv(0) returns .
  • normcdfinv(1) returns + .
  • normcdfinv(x) returns NaN if x is not in the interval [0,1].

__device__ ​ double pow ( double  x, double  y )

Calculate the value of first argument to the power of second argument. Calculate the value of x to the power of y

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • pow( ± 0 , y) returns ± for y an integer less than 0.
  • pow( ± 0 , y) returns ± 0 for y an odd integer greater than 0.
  • pow( ± 0 , y) returns +0 for y > 0 and not and odd integer.
  • pow(-1, ± ) returns 1.
  • pow(+1, y) returns 1 for any y, even a NaN.
  • pow(x, ± 0 ) returns 1 for any x, even a NaN.
  • pow(x, y) returns a NaN for finite x < 0 and finite non-integer y.
  • pow(x, ) returns + for | x | < 1 .
  • pow(x, ) returns +0 for | x | > 1 .
  • pow(x, + ) returns +0 for | x | < 1 .
  • pow(x, + ) returns + for | x | > 1 .
  • pow( , y) returns -0 for y an odd integer less than 0.
  • pow( , y) returns +0 for y < 0 and not an odd integer.
  • pow( , y) returns for y an odd integer greater than 0.
  • pow( , y) returns + for y > 0 and not an odd integer.
  • pow( + , y) returns +0 for y < 0.
  • pow( + , y) returns + for y > 0.

__device__ ​ double rcbrt ( double  x )

Calculate reciprocal cube root function. Calculate reciprocal cube root function of x

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • rcbrt( ± 0 ) returns ± .
  • rcbrt( ± ) returns ± 0 .

__device__ ​ double remainder ( double  x, double  y )

Compute double-precision floating-point remainder. Compute double-precision floating-point remainder r of dividing x by y for nonzero y. Thus r = x n y . The value n is the integer value nearest x y . In the case when | n x y | = 1 2 , the even n value is chosen.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • remainder(x, 0) returns NaN.
  • remainder( ± , y) returns NaN.
  • remainder(x, ± ) returns x for finite x.

__device__ ​ double remquo ( double  x, double  y, int* quo )

Compute double-precision floating-point remainder and part of quotient. Compute a double-precision floating-point remainder in the same way as the remainder() function. Argument quo returns part of quotient upon division of x by y. Value quo has the same sign as x y and may not be the exact quotient but agrees with the exact quotient in the low order 3 bits.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the remainder.

  • remquo(x, 0, quo) returns NaN.
  • remquo( ± , y, quo) returns NaN.
  • remquo(x, ± , quo) returns x.

__device__ ​ double rint ( double  x )

Round to nearest integer value in floating-point. Round x to the nearest integer value in floating-point format, with halfway cases rounded towards zero.

Returns

Returns rounded integer value.

__device__ ​ double round ( double  x )

Round to nearest integer value in floating-point. Round x to the nearest integer value in floating-point format, with halfway cases rounded away from zero.

Note:

This function may be slower than alternate rounding methods. See rint().

Returns

Returns rounded integer value.

__device__ ​ double rsqrt ( double  x )

Calculate the reciprocal of the square root of the input argument. Calculate the reciprocal of the nonnegative square root of x, 1 / x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns 1 / x .

  • rsqrt( + ) returns +0.
  • rsqrt( ± 0 ) returns ± .
  • rsqrt(x) returns NaN if x is less than 0.

__device__ ​ double scalbln ( double  x, long int  n )

Scale floating-point input by integer power of two. Scale x by 2 n by efficient manipulation of the floating-point exponent.

Returns

Returns x * 2 n .

  • scalbln( ± 0 , n) returns ± 0 .
  • scalbln(x, 0) returns x.
  • scalbln( ± , n) returns ± .

__device__ ​ double scalbn ( double  x, int  n )

Scale floating-point input by integer power of two. Scale x by 2 n by efficient manipulation of the floating-point exponent.

Returns

Returns x * 2 n .

  • scalbn( ± 0 , n) returns ± 0 .
  • scalbn(x, 0) returns x.
  • scalbn( ± , n) returns ± .

__device__ ​ int signbit ( double  a )

Return the sign bit of the input. Determine whether the floating-point value a is negative.

Returns

Returns a nonzero value if and only if a is negative. Reports the sign bit of all values including infinities, zeros, and NaNs.

__device__ ​ double sin ( double  x )

Calculate the sine of the input argument. Calculate the sine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • sin( ± 0 ) returns ± 0 .
  • sin( ± ) returns NaN.

__device__ ​ void sincos ( double  x, double* sptr, double* cptr )

Calculate the sine and cosine of the first input argument. Calculate the sine and cosine of the first input argument x (measured in radians). The results for sine and cosine are written into the second argument, sptr, and, respectively, third argument, cptr.

See also:

sin() and cos().

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • none

__device__ ​ void sincospi ( double  x, double* sptr, double* cptr )

Calculate the sine and cosine of the first input argument $\times \pi$ ×π. Calculate the sine and cosine of the first input argument, x (measured in radians), × π . The results for sine and cosine are written into the second argument, sptr, and, respectively, third argument, cptr.

See also:

sinpi() and cospi().

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • none

__device__ ​ double sinh ( double  x )

Calculate the hyperbolic sine of the input argument. Calculate the hyperbolic sine of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • sinh( ± 0 ) returns ± 0 .

__device__ ​ double sinpi ( double  x )

Calculate the sine of the input argument $\times \pi$ ×π. Calculate the sine of x × π (measured in radians), where x is the input argument.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • sinpi( ± 0 ) returns ± 0 .
  • sinpi( ± ) returns NaN.

__device__ ​ double sqrt ( double  x )

Calculate the square root of the input argument. Calculate the nonnegative square root of x, x .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns x .

  • sqrt( ± 0 ) returns ± 0 .
  • sqrt( + ) returns + .
  • sqrt(x) returns NaN if x is less than 0.

__device__ ​ double tan ( double  x )

Calculate the tangent of the input argument. Calculate the tangent of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • tan( ± 0 ) returns ± 0 .
  • tan( ± ) returns NaN.

__device__ ​ double tanh ( double  x )

Calculate the hyperbolic tangent of the input argument. Calculate the hyperbolic tangent of the input argument x (measured in radians).

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • tanh( ± 0 ) returns ± 0 .

__device__ ​ double tgamma ( double  x )

Calculate the gamma function of the input argument. Calculate the gamma function of the input argument x, namely the value of 0 e t t x 1 d t .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

  • tgamma( ± 0 ) returns ± .
  • tgamma(2) returns +0.
  • tgamma(x) returns ± if the correctly calculated value is outside the double floating point range.
  • tgamma(x) returns NaN if x < 0.
  • tgamma( ) returns NaN.
  • tgamma( + ) returns + .

__device__ ​ double trunc ( double  x )

Truncate input argument to the integral part. Round x to the nearest integer value that does not exceed x in magnitude.

Returns

Returns truncated integer value.

__device__ ​ double y0 ( double  x )

Calculate the value of the Bessel function of the second kind of order 0 for the input argument. Calculate the value of the Bessel function of the second kind of order 0 for the input argument x, Y 0 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the value of the Bessel function of the second kind of order 0.

  • y0(0) returns .
  • y0(x) returns NaN for x < 0.
  • y0( + ) returns +0.
  • y0(NaN) returns NaN.

__device__ ​ double y1 ( double  x )

Calculate the value of the Bessel function of the second kind of order 1 for the input argument. Calculate the value of the Bessel function of the second kind of order 1 for the input argument x, Y 1 ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the value of the Bessel function of the second kind of order 1.

  • y1(0) returns .
  • y1(x) returns NaN for x < 0.
  • y1( + ) returns +0.
  • y1(NaN) returns NaN.

__device__ ​ double yn ( int  n, double  x )

Calculate the value of the Bessel function of the second kind of order n for the input argument. Calculate the value of the Bessel function of the second kind of order n for the input argument x, Y n ( x ) .

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the value of the Bessel function of the second kind of order n.

  • yn(n, x) returns NaN for n < 0.
  • yn(n, 0) returns .
  • yn(n, x) returns NaN for x < 0.
  • yn(n, + ) returns +0.
  • yn(n, NaN) returns NaN.

Single Precision Intrinsics

Description

This section describes single precision intrinsic functions that are only supported in device code.

Functions

__device__ ​ __cudart_builtin__ float __cosf ( float  x )
Calculate the fast approximate cosine of the input argument.
__device__ ​ __cudart_builtin__ float __exp10f ( float  x )
Calculate the fast approximate base 10 exponential of the input argument.
__device__ ​ __cudart_builtin__ float __expf ( float  x )
Calculate the fast approximate base $e$ e exponential of the input argument.
__device__ ​ float __fadd_rd ( float  x, float  y )
Add two floating point values in round-down mode.
__device__ ​ float __fadd_rn ( float  x, float  y )
Add two floating point values in round-to-nearest-even mode.
__device__ ​ float __fadd_ru ( float  x, float  y )
Add two floating point values in round-up mode.
__device__ ​ float __fadd_rz ( float  x, float  y )
Add two floating point values in round-towards-zero mode.
__device__ ​ float __fdiv_rd ( float  x, float  y )
Divide two floating point values in round-down mode.
__device__ ​ float __fdiv_rn ( float  x, float  y )
Divide two floating point values in round-to-nearest-even mode.
__device__ ​ float __fdiv_ru ( float  x, float  y )
Divide two floating point values in round-up mode.
__device__ ​ float __fdiv_rz ( float  x, float  y )
Divide two floating point values in round-towards-zero mode.
__device__ ​ float __fdividef ( float  x, float  y )
Calculate the fast approximate division of the input arguments.
__device__ ​ float __fmaf_rd ( float  x, float  y, float  z )
Compute $x \times y + z$ x×y+z as a single operation, in round-down mode.
__device__ ​ float __fmaf_rn ( float  x, float  y, float  z )
Compute $x \times y + z$ x×y+z as a single operation, in round-to-nearest-even mode.
__device__ ​ float __fmaf_ru ( float  x, float  y, float  z )
Compute $x \times y + z$ x×y+z as a single operation, in round-up mode.
__device__ ​ float __fmaf_rz ( float  x, float  y, float  z )
Compute $x \times y + z$ x×y+z as a single operation, in round-towards-zero mode.
__device__ ​ float __fmul_rd ( float  x, float  y )
Multiply two floating point values in round-down mode.
__device__ ​ float __fmul_rn ( float  x, float  y )
Multiply two floating point values in round-to-nearest-even mode.
__device__ ​ float __fmul_ru ( float  x, float  y )
Multiply two floating point values in round-up mode.
__device__ ​ float __fmul_rz ( float  x, float  y )
Multiply two floating point values in round-towards-zero mode.
__device__ ​ float __frcp_rd ( float  x )
Compute $\frac{1}{x}$ 1x in round-down mode.
__device__ ​ float __frcp_rn ( float  x )
Compute $\frac{1}{x}$ 1x in round-to-nearest-even mode.
__device__ ​ float __frcp_ru ( float  x )
Compute $\frac{1}{x}$ 1x in round-up mode.
__device__ ​ float __frcp_rz ( float  x )
Compute $\frac{1}{x}$ 1x in round-towards-zero mode.
__device__ ​ float __frsqrt_rn ( float  x )
Compute $1/\sqrt{x}$ 1/x in round-to-nearest-even mode.
__device__ ​ float __fsqrt_rd ( float  x )
Compute $\sqrt{x}$ x in round-down mode.
__device__ ​ float __fsqrt_rn ( float  x )
Compute $\sqrt{x}$ x in round-to-nearest-even mode.
__device__ ​ float __fsqrt_ru ( float  x )
Compute $\sqrt{x}$ x in round-up mode.
__device__ ​ float __fsqrt_rz ( float  x )
Compute $\sqrt{x}$ x in round-towards-zero mode.
__device__ ​ __cudart_builtin__ float __log10f ( float  x )
Calculate the fast approximate base 10 logarithm of the input argument.
__device__ ​ __cudart_builtin__ float __log2f ( float  x )
Calculate the fast approximate base 2 logarithm of the input argument.
__device__ ​ __cudart_builtin__ float __logf ( float  x )
Calculate the fast approximate base $e$ e logarithm of the input argument.
__device__ ​ __cudart_builtin__ float __powf ( float  x, float  y )
Calculate the fast approximate of $x^y$ xy.
__device__ ​ float __saturatef ( float  x )
Clamp the input argument to [+0.0, 1.0].
__device__ ​ __cudart_builtin__ void __sincosf ( float  x, float* sptr, float* cptr )
Calculate the fast approximate of sine and cosine of the first input argument.
__device__ ​ __cudart_builtin__ float __sinf ( float  x )
Calculate the fast approximate sine of the input argument.
__device__ ​ __cudart_builtin__ float __tanf ( float  x )
Calculate the fast approximate tangent of the input argument.

Functions

__device__ ​ __cudart_builtin__ float __cosf ( float  x )

Calculate the fast approximate cosine of the input argument. Calculate the fast approximate cosine of the input argument x, measured in radians.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Input and output in the denormal range is flushed to sign preserving 0.0.

Returns

Returns the approximate cosine of x.

__device__ ​ __cudart_builtin__ float __exp10f ( float  x )

Calculate the fast approximate base 10 exponential of the input argument. Calculate the fast approximate base 10 exponential of the input argument x, 10 x .

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Most input and output values around denormal range are flushed to sign preserving 0.0.

Returns

Returns an approximation to 10 x .

__device__ ​ __cudart_builtin__ float __expf ( float  x )

Calculate the fast approximate base $e$ e exponential of the input argument. Calculate the fast approximate base e exponential of the input argument x, e x .

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Most input and output values around denormal range are flushed to sign preserving 0.0.

Returns

Returns an approximation to e x .

__device__ ​ float __fadd_rd ( float  x, float  y )

Add two floating point values in round-down mode. Compute the sum of x and y in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ float __fadd_rn ( float  x, float  y )

Add two floating point values in round-to-nearest-even mode. Compute the sum of x and y in round-to-nearest-even rounding mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ float __fadd_ru ( float  x, float  y )

Add two floating point values in round-up mode. Compute the sum of x and y in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ float __fadd_rz ( float  x, float  y )

Add two floating point values in round-towards-zero mode. Compute the sum of x and y in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ float __fdiv_rd ( float  x, float  y )

Divide two floating point values in round-down mode. Divide two floating point values x by y in round-down (to negative infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x / y.

__device__ ​ float __fdiv_rn ( float  x, float  y )

Divide two floating point values in round-to-nearest-even mode. Divide two floating point values x by y in round-to-nearest-even mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x / y.

__device__ ​ float __fdiv_ru ( float  x, float  y )

Divide two floating point values in round-up mode. Divide two floating point values x by y in round-up (to positive infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x / y.

__device__ ​ float __fdiv_rz ( float  x, float  y )

Divide two floating point values in round-towards-zero mode. Divide two floating point values x by y in round-towards-zero mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x / y.

__device__ ​ float __fdividef ( float  x, float  y )

Calculate the fast approximate division of the input arguments. Calculate the fast approximate division of x by y.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

Returns

Returns x / y.

  • __fdividef( , y) returns NaN for 2 126 < y < 2 128 .
  • __fdividef(x, y) returns 0 for 2 126 < y < 2 128 and x .

__device__ ​ float __fmaf_rd ( float  x, float  y, float  z )

Compute $x \times y + z$ x×y+z as a single operation, in round-down mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-down (to negative infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact + .
  • fmaf(x, y, + ) returns NaN if x × y is an exact .

__device__ ​ float __fmaf_rn ( float  x, float  y, float  z )

Compute $x \times y + z$ x×y+z as a single operation, in round-to-nearest-even mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-to-nearest-even mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact + .
  • fmaf(x, y, + ) returns NaN if x × y is an exact .

__device__ ​ float __fmaf_ru ( float  x, float  y, float  z )

Compute $x \times y + z$ x×y+z as a single operation, in round-up mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-up (to positive infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact + .
  • fmaf(x, y, + ) returns NaN if x × y is an exact .

__device__ ​ float __fmaf_rz ( float  x, float  y, float  z )

Compute $x \times y + z$ x×y+z as a single operation, in round-towards-zero mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-towards-zero mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact + .
  • fmaf(x, y, + ) returns NaN if x × y is an exact .

__device__ ​ float __fmul_rd ( float  x, float  y )

Multiply two floating point values in round-down mode. Compute the product of x and y in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ float __fmul_rn ( float  x, float  y )

Multiply two floating point values in round-to-nearest-even mode. Compute the product of x and y in round-to-nearest-even mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ float __fmul_ru ( float  x, float  y )

Multiply two floating point values in round-up mode. Compute the product of x and y in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ float __fmul_rz ( float  x, float  y )

Multiply two floating point values in round-towards-zero mode. Compute the product of x and y in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ float __frcp_rd ( float  x )

Compute $\frac{1}{x}$ 1x in round-down mode. Compute the reciprocal of x in round-down (to negative infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 1 x .

__device__ ​ float __frcp_rn ( float  x )

Compute $\frac{1}{x}$ 1x in round-to-nearest-even mode. Compute the reciprocal of x in round-to-nearest-even mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 1 x .

__device__ ​ float __frcp_ru ( float  x )

Compute $\frac{1}{x}$ 1x in round-up mode. Compute the reciprocal of x in round-up (to positive infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 1 x .

__device__ ​ float __frcp_rz ( float  x )

Compute $\frac{1}{x}$ 1x in round-towards-zero mode. Compute the reciprocal of x in round-towards-zero mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 1 x .

__device__ ​ float __frsqrt_rn ( float  x )

Compute $1/\sqrt{x}$ 1/x in round-to-nearest-even mode. Compute the reciprocal square root of x in round-to-nearest-even mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns 1 / x .

__device__ ​ float __fsqrt_rd ( float  x )

Compute $\sqrt{x}$ x in round-down mode. Compute the square root of x in round-down (to negative infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x .

__device__ ​ float __fsqrt_rn ( float  x )

Compute $\sqrt{x}$ x in round-to-nearest-even mode. Compute the square root of x in round-to-nearest-even mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x .

__device__ ​ float __fsqrt_ru ( float  x )

Compute $\sqrt{x}$ x in round-up mode. Compute the square root of x in round-up (to positive infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x .

__device__ ​ float __fsqrt_rz ( float  x )

Compute $\sqrt{x}$ x in round-towards-zero mode. Compute the square root of x in round-towards-zero mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-1.

Returns

Returns x .

__device__ ​ __cudart_builtin__ float __log10f ( float  x )

Calculate the fast approximate base 10 logarithm of the input argument. Calculate the fast approximate base 10 logarithm of the input argument x.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Most input and output values around denormal range are flushed to sign preserving 0.0.

Returns

Returns an approximation to log 10 ( x ) .

__device__ ​ __cudart_builtin__ float __log2f ( float  x )

Calculate the fast approximate base 2 logarithm of the input argument. Calculate the fast approximate base 2 logarithm of the input argument x.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Input and output in the denormal range is flushed to sign preserving 0.0.

Returns

Returns an approximation to log 2 ( x ) .

__device__ ​ __cudart_builtin__ float __logf ( float  x )

Calculate the fast approximate base $e$ e logarithm of the input argument. Calculate the fast approximate base e logarithm of the input argument x.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Most input and output values around denormal range are flushed to sign preserving 0.0.

Returns

Returns an approximation to log e ( x ) .

__device__ ​ __cudart_builtin__ float __powf ( float  x, float  y )

Calculate the fast approximate of $x^y$ xy. Calculate the fast approximate of x, the first input argument, raised to the power of y, the second input argument, x y .

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Most input and output values around denormal range are flushed to sign preserving 0.0.

Returns

Returns an approximation to x y .

__device__ ​ float __saturatef ( float  x )

Clamp the input argument to [+0.0, 1.0]. Clamp the input argument x to be within the interval [+0.0, 1.0].

Returns

  • __saturatef(x) returns 0 if x < 0.
  • __saturatef(x) returns 1 if x > 1.
  • __saturatef(x) returns x if 0 x 1 .
  • __saturatef(NaN) returns 0.

__device__ ​ __cudart_builtin__ void __sincosf ( float  x, float* sptr, float* cptr )

Calculate the fast approximate of sine and cosine of the first input argument. Calculate the fast approximate of sine and cosine of the first input argument x (measured in radians). The results for sine and cosine are written into the second argument, sptr, and, respectively, third argument, cptr.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Denorm input/output is flushed to sign preserving 0.0.

Returns

  • none

__device__ ​ __cudart_builtin__ float __sinf ( float  x )

Calculate the fast approximate sine of the input argument. Calculate the fast approximate sine of the input argument x, measured in radians.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • Input and output in the denormal range is flushed to sign preserving 0.0.

Returns

Returns the approximate sine of x.

__device__ ​ __cudart_builtin__ float __tanf ( float  x )

Calculate the fast approximate tangent of the input argument. Calculate the fast approximate tangent of the input argument x, measured in radians.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-4.

  • The result is computed as the fast divide of __sinf() by __cosf(). Denormal input and output are flushed to sign-preserving 0.0 at each step of the computation.

Returns

Returns the approximate tangent of x.

Double Precision Intrinsics

Description

This section describes double precision intrinsic functions that are only supported in device code.

Functions

__device__ ​ double __dadd_rd ( double  x, double  y )
Add two floating point values in round-down mode.
__device__ ​ double __dadd_rn ( double  x, double  y )
Add two floating point values in round-to-nearest-even mode.
__device__ ​ double __dadd_ru ( double  x, double  y )
Add two floating point values in round-up mode.
__device__ ​ double __dadd_rz ( double  x, double  y )
Add two floating point values in round-towards-zero mode.
__device__ ​ double __ddiv_rd ( double  x, double  y )
Divide two floating point values in round-down mode.
__device__ ​ double __ddiv_rn ( double  x, double  y )
Divide two floating point values in round-to-nearest-even mode.
__device__ ​ double __ddiv_ru ( double  x, double  y )
Divide two floating point values in round-up mode.
__device__ ​ double __ddiv_rz ( double  x, double  y )
Divide two floating point values in round-towards-zero mode.
__device__ ​ double __dmul_rd ( double  x, double  y )
Multiply two floating point values in round-down mode.
__device__ ​ double __dmul_rn ( double  x, double  y )
Multiply two floating point values in round-to-nearest-even mode.
__device__ ​ double __dmul_ru ( double  x, double  y )
Multiply two floating point values in round-up mode.
__device__ ​ double __dmul_rz ( double  x, double  y )
Multiply two floating point values in round-towards-zero mode.
__device__ ​ double __drcp_rd ( double  x )
Compute $\frac{1}{x}$ 1x in round-down mode.
__device__ ​ double __drcp_rn ( double  x )
Compute $\frac{1}{x}$ 1x in round-to-nearest-even mode.
__device__ ​ double __drcp_ru ( double  x )
Compute $\frac{1}{x}$ 1x in round-up mode.
__device__ ​ double __drcp_rz ( double  x )
Compute $\frac{1}{x}$ 1x in round-towards-zero mode.
__device__ ​ double __dsqrt_rd ( double  x )
Compute $\sqrt{x}$ x in round-down mode.
__device__ ​ double __dsqrt_rn ( double  x )
Compute $\sqrt{x}$ x in round-to-nearest-even mode.
__device__ ​ double __dsqrt_ru ( double  x )
Compute $\sqrt{x}$ x in round-up mode.
__device__ ​ double __dsqrt_rz ( double  x )
Compute $\sqrt{x}$ x in round-towards-zero mode.
__device__ ​ double __fma_rd ( double  x, double  y, double  z )
Compute $x \times y + z$ x×y+z as a single operation in round-down mode.
__device__ ​ double __fma_rn ( double  x, double  y, double  z )
Compute $x \times y + z$ x×y+z as a single operation in round-to-nearest-even mode.
__device__ ​ double __fma_ru ( double  x, double  y, double  z )
Compute $x \times y + z$ x×y+z as a single operation in round-up mode.
__device__ ​ double __fma_rz ( double  x, double  y, double  z )
Compute $x \times y + z$ x×y+z as a single operation in round-towards-zero mode.

Functions

__device__ ​ double __dadd_rd ( double  x, double  y )

Add two floating point values in round-down mode. Adds two floating point values x and y in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ double __dadd_rn ( double  x, double  y )

Add two floating point values in round-to-nearest-even mode. Adds two floating point values x and y in round-to-nearest-even mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ double __dadd_ru ( double  x, double  y )

Add two floating point values in round-up mode. Adds two floating point values x and y in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ double __dadd_rz ( double  x, double  y )

Add two floating point values in round-towards-zero mode. Adds two floating point values x and y in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x + y.

__device__ ​ double __ddiv_rd ( double  x, double  y )

Divide two floating point values in round-down mode. Divides two floating point values x by y in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x / y.

__device__ ​ double __ddiv_rn ( double  x, double  y )

Divide two floating point values in round-to-nearest-even mode. Divides two floating point values x by y in round-to-nearest-even mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x / y.

__device__ ​ double __ddiv_ru ( double  x, double  y )

Divide two floating point values in round-up mode. Divides two floating point values x by y in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x / y.

__device__ ​ double __ddiv_rz ( double  x, double  y )

Divide two floating point values in round-towards-zero mode. Divides two floating point values x by y in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x / y.

__device__ ​ double __dmul_rd ( double  x, double  y )

Multiply two floating point values in round-down mode. Multiplies two floating point values x and y in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ double __dmul_rn ( double  x, double  y )

Multiply two floating point values in round-to-nearest-even mode. Multiplies two floating point values x and y in round-to-nearest-even mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ double __dmul_ru ( double  x, double  y )

Multiply two floating point values in round-up mode. Multiplies two floating point values x and y in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ double __dmul_rz ( double  x, double  y )

Multiply two floating point values in round-towards-zero mode. Multiplies two floating point values x and y in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • This operation will never be merged into a single multiply-add instruction.

Returns

Returns x * y.

__device__ ​ double __drcp_rd ( double  x )

Compute $\frac{1}{x}$ 1x in round-down mode. Compute the reciprocal of x in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns 1 x .

__device__ ​ double __drcp_rn ( double  x )

Compute $\frac{1}{x}$ 1x in round-to-nearest-even mode. Compute the reciprocal of x in round-to-nearest-even mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns 1 x .

__device__ ​ double __drcp_ru ( double  x )

Compute $\frac{1}{x}$ 1x in round-up mode. Compute the reciprocal of x in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns 1 x .

__device__ ​ double __drcp_rz ( double  x )

Compute $\frac{1}{x}$ 1x in round-towards-zero mode. Compute the reciprocal of x in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns 1 x .

__device__ ​ double __dsqrt_rd ( double  x )

Compute $\sqrt{x}$ x in round-down mode. Compute the square root of x in round-down (to negative infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x .

__device__ ​ double __dsqrt_rn ( double  x )

Compute $\sqrt{x}$ x in round-to-nearest-even mode. Compute the square root of x in round-to-nearest-even mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x .

__device__ ​ double __dsqrt_ru ( double  x )

Compute $\sqrt{x}$ x in round-up mode. Compute the square root of x in round-up (to positive infinity) mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x .

__device__ ​ double __dsqrt_rz ( double  x )

Compute $\sqrt{x}$ x in round-towards-zero mode. Compute the square root of x in round-towards-zero mode.

Note:
  • For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

  • Requires compute capability >= 2.0.

Returns

Returns x .

__device__ ​ double __fma_rd ( double  x, double  y, double  z )

Compute $x \times y + z$ x×y+z as a single operation in round-down mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-down (to negative infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact +
  • fmaf(x, y, + ) returns NaN if x × y is an exact

__device__ ​ double __fma_rn ( double  x, double  y, double  z )

Compute $x \times y + z$ x×y+z as a single operation in round-to-nearest-even mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-to-nearest-even mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact +
  • fmaf(x, y, + ) returns NaN if x × y is an exact

__device__ ​ double __fma_ru ( double  x, double  y, double  z )

Compute $x \times y + z$ x×y+z as a single operation in round-up mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-up (to postive infinity) mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact +
  • fmaf(x, y, + ) returns NaN if x × y is an exact

__device__ ​ double __fma_rz ( double  x, double  y, double  z )

Compute $x \times y + z$ x×y+z as a single operation in round-towards-zero mode. Computes the value of x × y + z as a single ternary operation, rounding the result once in round-towards-zero mode.

Note:

For accuracy information for this function see the CUDA C Programming Guide, Appendix C, Table C-2.

Returns

Returns the rounded value of x × y + z as a single operation.

  • fmaf( ± , ± 0 , z) returns NaN.
  • fmaf( ± 0 , ± , z) returns NaN.
  • fmaf(x, y, ) returns NaN if x × y is an exact +
  • fmaf(x, y, + ) returns NaN if x × y is an exact

Integer Intrinsics

Description

This section describes integer intrinsic functions that are only supported in device code.

Functions

__device__ ​ unsigned int __brev ( unsigned int  x )
Reverse the bit order of a 32 bit unsigned integer.
__device__ ​ unsigned long long int __brevll ( unsigned long long int x )
Reverse the bit order of a 64 bit unsigned integer.
__device__ ​ unsigned int __byte_perm ( unsigned int  x, unsigned int  y, unsigned int  s )
Return selected bytes from two 32 bit unsigned integers.
__device__ ​ int __clz ( int  x )
Return the number of consecutive high-order zero bits in a 32 bit integer.
__device__ ​ int __clzll ( long long int x )
Count the number of consecutive high-order zero bits in a 64 bit integer.
__device__ ​ int __ffs ( int  x )
Find the position of the least significant bit set to 1 in a 32 bit integer.
__device__ ​ int __ffsll ( long long int x )
Find the position of the least significant bit set to 1 in a 64 bit integer.
__device__ ​ int __mul24 ( int  x, int  y )
Calculate the least significant 32 bits of the product of the least significant 24 bits of two integers.
__device__ ​ long long int __mul64hi ( long long int x, long long int y )
Calculate the most significant 64 bits of the product of the two 64 bit integers.
__device__ ​ int __mulhi ( int  x, int  y )
Calculate the most significant 32 bits of the product of the two 32 bit integers.
__device__ ​ int __popc ( unsigned int  x )
Count the number of bits that are set to 1 in a 32 bit integer.
__device__ ​ int __popcll ( unsigned long long int x )
Count the number of bits that are set to 1 in a 64 bit integer.
__device__ ​ unsigned int __sad ( int  x, int  y, unsigned int  z )
Calculate $|x - y| + z$ |x−y|+z , the sum of absolute difference.
__device__ ​ unsigned int __umul24 ( unsigned int  x, unsigned int  y )
Calculate the least significant 32 bits of the product of the least significant 24 bits of two unsigned integers.
__device__ ​ unsigned long long int __umul64hi ( unsigned long long int x, unsigned long long int y )
Calculate the most significant 64 bits of the product of the two 64 unsigned bit integers.
__device__ ​ unsigned int __umulhi ( unsigned int  x, unsigned int  y )
Calculate the most significant 32 bits of the product of the two 32 bit unsigned integers.
__device__ ​ unsigned int __usad ( unsigned int  x, unsigned int  y, unsigned int  z )
Calculate $|x - y| + z$ |x−y|+z , the sum of absolute difference.

Functions

__device__ ​ unsigned int __brev ( unsigned int  x )

Reverse the bit order of a 32 bit unsigned integer. Reverses the bit order of the 32 bit unsigned integer x.

Returns

Returns the bit-reversed value of x. i.e. bit N of the return value corresponds to bit 31-N of x.

__device__ ​ unsigned long long int __brevll ( unsigned long long int x )

Reverse the bit order of a 64 bit unsigned integer. Reverses the bit order of the 64 bit unsigned integer x.

Returns

Returns the bit-reversed value of x. i.e. bit N of the return value corresponds to bit 63-N of x.

__device__ ​ unsigned int __byte_perm ( unsigned int  x, unsigned int  y, unsigned int  s )

Return selected bytes from two 32 bit unsigned integers. byte_perm(x,y,s) returns a 32-bit integer consisting of four bytes from eight input bytes provided in the two input integers x and y, as specified by a selector, s.

The input bytes are indexed as follows: input[0] = x<0:7> input[1] = x<8:15> input[2] = x<16:23> input[3] = x<24:31> input[4] = y<0:7> input[5] = y<8:15> input[6] = y<16:23> input[7] = y<24:31> The selector indices are stored in 4-bit nibbles (with the upper 16-bits of the selector not being used): selector[0] = s<0:3> selector[1] = s<4:7> selector[2] = s<8:11> selector[3] = s<12:15>

Returns

The returned value r is computed to be: result[n] := input[selector[n]] where result[n] is the nth byte of r.

__device__ ​ int __clz ( int  x )

Return the number of consecutive high-order zero bits in a 32 bit integer. Count the number of consecutive leading zero bits, starting at the most significant bit (bit 31) of x.

Returns

Returns a value between 0 and 32 inclusive representing the number of zero bits.

__device__ ​ int __clzll ( long long int x )

Count the number of consecutive high-order zero bits in a 64 bit integer. Count the number of consecutive leading zero bits, starting at the most significant bit (bit 63) of x.

Returns

Returns a value between 0 and 64 inclusive representing the number of zero bits.

__device__ ​ int __ffs ( int  x )

Find the position of the least significant bit set to 1 in a 32 bit integer. Find the position of the first (least significant) bit set to 1 in x, where the least significant bit position is 1.

Returns

Returns a value between 0 and 32 inclusive representing the position of the first bit set.

  • __ffs(0) returns 0.

__device__ ​ int __ffsll ( long long int x )

Find the position of the least significant bit set to 1 in a 64 bit integer. Find the position of the first (least significant) bit set to 1 in x, where the least significant bit position is 1.

Returns

Returns a value between 0 and 64 inclusive representing the position of the first bit set.

  • __ffsll(0) returns 0.

__device__ ​ int __mul24 ( int  x, int  y )

Calculate the least significant 32 bits of the product of the least significant 24 bits of two integers. Calculate the least significant 32 bits of the product of the least significant 24 bits of x and y. The high order 8 bits of x and y are ignored.

Returns

Returns the least significant 32 bits of the product x * y.

__device__ ​ long long int __mul64hi ( long long int x, long long int y )

Calculate the most significant 64 bits of the product of the two 64 bit integers. Calculate the most significant 64 bits of the 128-bit product x * y, where x and y are 64-bit integers.

Returns

Returns the most significant 64 bits of the product x * y.

__device__ ​ int __mulhi ( int  x, int  y )

Calculate the most significant 32 bits of the product of the two 32 bit integers. Calculate the most significant 32 bits of the 64-bit product x * y, where x and y are 32-bit integers.

Returns

Returns the most significant 32 bits of the product x * y.

__device__ ​ int __popc ( unsigned int  x )

Count the number of bits that are set to 1 in a 32 bit integer. Count the number of bits that are set to 1 in x.

Returns

Returns a value between 0 and 32 inclusive representing the number of set bits.

__device__ ​ int __popcll ( unsigned long long int x )

Count the number of bits that are set to 1 in a 64 bit integer. Count the number of bits that are set to 1 in x.

Returns

Returns a value between 0 and 64 inclusive representing the number of set bits.

__device__ ​ unsigned int __sad ( int  x, int  y, unsigned int  z )

Calculate $|x - y| + z$ |x−y|+z , the sum of absolute difference. Calculate | x y | + z , the 32-bit sum of the third argument z plus and the absolute value of the difference between the first argument, x, and second argument, y.

Inputs x and y are signed 32-bit integers, input z is a 32-bit unsigned integer.

Returns

Returns | x y | + z .

__device__ ​ unsigned int __umul24 ( unsigned int  x, unsigned int  y )

Calculate the least significant 32 bits of the product of the least significant 24 bits of two unsigned integers. Calculate the least significant 32 bits of the product of the least significant 24 bits of x and y. The high order 8 bits of x and y are ignored.

Returns

Returns the least significant 32 bits of the product x * y.

__device__ ​ unsigned long long int __umul64hi ( unsigned long long int x, unsigned long long int y )

Calculate the most significant 64 bits of the product of the two 64 unsigned bit integers. Calculate the most significant 64 bits of the 128-bit product x * y, where x and y are 64-bit unsigned integers.

Returns

Returns the most significant 64 bits of the product x * y.

__device__ ​ unsigned int __umulhi ( unsigned int  x, unsigned int  y )

Calculate the most significant 32 bits of the product of the two 32 bit unsigned integers. Calculate the most significant 32 bits of the 64-bit product x * y, where x and y are 32-bit unsigned integers.

Returns

Returns the most significant 32 bits of the product x * y.

__device__ ​ unsigned int __usad ( unsigned int  x, unsigned int  y, unsigned int  z )

Calculate $|x - y| + z$ |x−y|+z , the sum of absolute difference. Calculate | x y | + z , the 32-bit sum of the third argument z plus and the absolute value of the difference between the first argument, x, and second argument, y.

Inputs x, y, and z are unsigned 32-bit integers.

Returns

Returns | x y | + z .

Type Casting Intrinsics

Description

This section describes type casting intrinsic functions that are only supported in device code.

Functions

__device__ ​ float __double2float_rd ( double  x )
Convert a double to a float in round-down mode.
__device__ ​ float __double2float_rn ( double  x )
Convert a double to a float in round-to-nearest-even mode.
__device__ ​ float __double2float_ru ( double  x )
Convert a double to a float in round-up mode.
__device__ ​ float __double2float_rz ( double  x )
Convert a double to a float in round-towards-zero mode.
__device__ ​ int __double2hiint ( double  x )
Reinterpret high 32 bits in a double as a signed integer.
__device__ ​ int __double2int_rd ( double  x )
Convert a double to a signed int in round-down mode.
__device__ ​ int __double2int_rn ( double  x )
Convert a double to a signed int in round-to-nearest-even mode.
__device__ ​ int __double2int_ru ( double  x )
Convert a double to a signed int in round-up mode.
__device__ ​ int __double2int_rz ( double )
Convert a double to a signed int in round-towards-zero mode.
__device__ ​ long long int __double2ll_rd ( double  x )
Convert a double to a signed 64-bit int in round-down mode.
__device__ ​ long long int __double2ll_rn ( double  x )
Convert a double to a signed 64-bit int in round-to-nearest-even mode.
__device__ ​ long long int __double2ll_ru ( double  x )
Convert a double to a signed 64-bit int in round-up mode.
__device__ ​ long long int __double2ll_rz ( double )
Convert a double to a signed 64-bit int in round-towards-zero mode.
__device__ ​ int __double2loint ( double  x )
Reinterpret low 32 bits in a double as a signed integer.
__device__ ​ unsigned int __double2uint_rd ( double  x )
Convert a double to an unsigned int in round-down mode.
__device__ ​ unsigned int __double2uint_rn ( double  x )
Convert a double to an unsigned int in round-to-nearest-even mode.
__device__ ​ unsigned int __double2uint_ru ( double  x )
Convert a double to an unsigned int in round-up mode.
__device__ ​ unsigned int __double2uint_rz ( double )
Convert a double to an unsigned int in round-towards-zero mode.
__device__ ​ unsigned long long int __double2ull_rd ( double  x )
Convert a double to an unsigned 64-bit int in round-down mode.
__device__ ​ unsigned long long int __double2ull_rn ( double  x )
Convert a double to an unsigned 64-bit int in round-to-nearest-even mode.
__device__ ​ unsigned long long int __double2ull_ru ( double  x )
Convert a double to an unsigned 64-bit int in round-up mode.
__device__ ​ unsigned long long int __double2ull_rz ( double )
Convert a double to an unsigned 64-bit int in round-towards-zero mode.
__device__ ​ long long int __double_as_longlong ( double  x )
Reinterpret bits in a double as a 64-bit signed integer.
__device__ ​ unsigned short __float2half_rn ( float  x )
Convert a single-precision float to a half-precision float in round-to-nearest-even mode.
__device__ ​ int __float2int_rd ( float  x )
Convert a float to a signed integer in round-down mode.
__device__ ​ int __float2int_rn ( float  x )
Convert a float to a signed integer in round-to-nearest-even mode.
__device__ ​ int __float2int_ru ( float )
Convert a float to a signed integer in round-up mode.
__device__ ​ int __float2int_rz ( float  x )
Convert a float to a signed integer in round-towards-zero mode.
__device__ ​ long long int __float2ll_rd ( float  x )
Convert a float to a signed 64-bit integer in round-down mode.
__device__ ​ long long int __float2ll_rn ( float  x )
Convert a float to a signed 64-bit integer in round-to-nearest-even mode.
__device__ ​ long long int __float2ll_ru ( float  x )
Convert a float to a signed 64-bit integer in round-up mode.
__device__ ​ long long int __float2ll_rz ( float  x )
Convert a float to a signed 64-bit integer in round-towards-zero mode.
__device__ ​ unsigned int __float2uint_rd ( float  x )
Convert a float to an unsigned integer in round-down mode.
__device__ ​ unsigned int __float2uint_rn ( float  x )
Convert a float to an unsigned integer in round-to-nearest-even mode.
__device__ ​ unsigned int __float2uint_ru ( float  x )
Convert a float to an unsigned integer in round-up mode.
__device__ ​ unsigned int __float2uint_rz ( float  x )
Convert a float to an unsigned integer in round-towards-zero mode.
__device__ ​ unsigned long long int __float2ull_rd ( float  x )
Convert a float to an unsigned 64-bit integer in round-down mode.
__device__ ​ unsigned long long int __float2ull_rn ( float  x )
Convert a float to an unsigned 64-bit integer in round-to-nearest-even mode.
__device__ ​ unsigned long long int __float2ull_ru ( float  x )
Convert a float to an unsigned 64-bit integer in round-up mode.
__device__ ​ unsigned long long int __float2ull_rz ( float  x )
Convert a float to an unsigned 64-bit integer in round-towards-zero mode.
__device__ ​ int __float_as_int ( float  x )
Reinterpret bits in a float as a signed integer.
__device__ ​ float __half2float ( unsigned short x )
Convert a half-precision float to a single-precision float in round-to-nearest-even mode.
__device__ ​ double __hiloint2double ( int  hi, int  lo )
Reinterpret high and low 32-bit integer values as a double.
__device__ ​ double __int2double_rn ( int  x )
Convert a signed int to a double.
__device__ ​ float __int2float_rd ( int  x )
Convert a signed integer to a float in round-down mode.
__device__ ​ float __int2float_rn ( int  x )
Convert a signed integer to a float in round-to-nearest-even mode.
__device__ ​ float __int2float_ru ( int  x )
Convert a signed integer to a float in round-up mode.
__device__ ​ float __int2float_rz ( int  x )
Convert a signed integer to a float in round-towards-zero mode.
__device__ ​ float __int_as_float ( int  x )
Reinterpret bits in an integer as a float.
__device__ ​ double __ll2double_rd ( long long int x )
Convert a signed 64-bit int to a double in round-down mode.
__device__ ​ double __ll2double_rn ( long long int x )
Convert a signed 64-bit int to a double in round-to-nearest-even mode.
__device__ ​ double __ll2double_ru ( long long int x )
Convert a signed 64-bit int to a double in round-up mode.
__device__ ​ double __ll2double_rz ( long long int x )
Convert a signed 64-bit int to a double in round-towards-zero mode.
__device__ ​ float __ll2float_rd ( long long int x )
Convert a signed integer to a float in round-down mode.
__device__ ​ float __ll2float_rn ( long long int x )
Convert a signed 64-bit integer to a float in round-to-nearest-even mode.
__device__ ​ float __ll2float_ru ( long long int x )
Convert a signed integer to a float in round-up mode.
__device__ ​ float __ll2float_rz ( long long int x )
Convert a signed integer to a float in round-towards-zero mode.
__device__ ​ double __longlong_as_double ( long long int x )
Reinterpret bits in a 64-bit signed integer as a double.
__device__ ​ double __uint2double_rn ( unsigned int  x )
Convert an unsigned int to a double.
__device__ ​ float __uint2float_rd ( unsigned int  x )
Convert an unsigned integer to a float in round-down mode.
__device__ ​ float __uint2float_rn ( unsigned int  x )
Convert an unsigned integer to a float in round-to-nearest-even mode.
__device__ ​ float __uint2float_ru ( unsigned int  x )
Convert an unsigned integer to a float in round-up mode.
__device__ ​ float __uint2float_rz ( unsigned int  x )
Convert an unsigned integer to a float in round-towards-zero mode.
__device__ ​ double __ull2double_rd ( unsigned long long int x )
Convert an unsigned 64-bit int to a double in round-down mode.
__device__ ​ double __ull2double_rn ( unsigned long long int x )
Convert an unsigned 64-bit int to a double in round-to-nearest-even mode.
__device__ ​ double __ull2double_ru ( unsigned long long int x )
Convert an unsigned 64-bit int to a double in round-up mode.
__device__ ​ double __ull2double_rz ( unsigned long long int x )
Convert an unsigned 64-bit int to a double in round-towards-zero mode.
__device__ ​ float __ull2float_rd ( unsigned long long int x )
Convert an unsigned integer to a float in round-down mode.
__device__ ​ float __ull2float_rn ( unsigned long long int x )
Convert an unsigned integer to a float in round-to-nearest-even mode.
__device__ ​ float __ull2float_ru ( unsigned long long int x )
Convert an unsigned integer to a float in round-up mode.
__device__ ​ float __ull2float_rz ( unsigned long long int x )
Convert an unsigned integer to a float in round-towards-zero mode.

Functions

__device__ ​ float __double2float_rd ( double  x )

Convert a double to a float in round-down mode. Convert the double-precision floating point value x to a single-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ float __double2float_rn ( double  x )

Convert a double to a float in round-to-nearest-even mode. Convert the double-precision floating point value x to a single-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ float __double2float_ru ( double  x )

Convert a double to a float in round-up mode. Convert the double-precision floating point value x to a single-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ float __double2float_rz ( double  x )

Convert a double to a float in round-towards-zero mode. Convert the double-precision floating point value x to a single-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ int __double2hiint ( double  x )

Reinterpret high 32 bits in a double as a signed integer. Reinterpret the high 32 bits in the double-precision floating point value x as a signed integer.

Returns

Returns reinterpreted value.

__device__ ​ int __double2int_rd ( double  x )

Convert a double to a signed int in round-down mode. Convert the double-precision floating point value x to a signed integer value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ int __double2int_rn ( double  x )

Convert a double to a signed int in round-to-nearest-even mode. Convert the double-precision floating point value x to a signed integer value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ int __double2int_ru ( double  x )

Convert a double to a signed int in round-up mode. Convert the double-precision floating point value x to a signed integer value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ int __double2int_rz ( double )

Convert a double to a signed int in round-towards-zero mode. Convert the double-precision floating point value x to a signed integer value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ long long int __double2ll_rd ( double  x )

Convert a double to a signed 64-bit int in round-down mode. Convert the double-precision floating point value x to a signed 64-bit integer value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ long long int __double2ll_rn ( double  x )

Convert a double to a signed 64-bit int in round-to-nearest-even mode. Convert the double-precision floating point value x to a signed 64-bit integer value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ long long int __double2ll_ru ( double  x )

Convert a double to a signed 64-bit int in round-up mode. Convert the double-precision floating point value x to a signed 64-bit integer value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ long long int __double2ll_rz ( double )

Convert a double to a signed 64-bit int in round-towards-zero mode. Convert the double-precision floating point value x to a signed 64-bit integer value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ int __double2loint ( double  x )

Reinterpret low 32 bits in a double as a signed integer. Reinterpret the low 32 bits in the double-precision floating point value x as a signed integer.

Returns

Returns reinterpreted value.

__device__ ​ unsigned int __double2uint_rd ( double  x )

Convert a double to an unsigned int in round-down mode. Convert the double-precision floating point value x to an unsigned integer value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned int __double2uint_rn ( double  x )

Convert a double to an unsigned int in round-to-nearest-even mode. Convert the double-precision floating point value x to an unsigned integer value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ unsigned int __double2uint_ru ( double  x )

Convert a double to an unsigned int in round-up mode. Convert the double-precision floating point value x to an unsigned integer value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned int __double2uint_rz ( double )

Convert a double to an unsigned int in round-towards-zero mode. Convert the double-precision floating point value x to an unsigned integer value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __double2ull_rd ( double  x )

Convert a double to an unsigned 64-bit int in round-down mode. Convert the double-precision floating point value x to an unsigned 64-bit integer value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __double2ull_rn ( double  x )

Convert a double to an unsigned 64-bit int in round-to-nearest-even mode. Convert the double-precision floating point value x to an unsigned 64-bit integer value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __double2ull_ru ( double  x )

Convert a double to an unsigned 64-bit int in round-up mode. Convert the double-precision floating point value x to an unsigned 64-bit integer value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __double2ull_rz ( double )

Convert a double to an unsigned 64-bit int in round-towards-zero mode. Convert the double-precision floating point value x to an unsigned 64-bit integer value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ long long int __double_as_longlong ( double  x )

Reinterpret bits in a double as a 64-bit signed integer. Reinterpret the bits in the double-precision floating point value x as a signed 64-bit integer.

Returns

Returns reinterpreted value.

__device__ ​ unsigned short __float2half_rn ( float  x )

Convert a single-precision float to a half-precision float in round-to-nearest-even mode. Convert the single-precision float value x to a half-precision floating point value represented in unsigned short format, in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ int __float2int_rd ( float  x )

Convert a float to a signed integer in round-down mode. Convert the single-precision floating point value x to a signed integer in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ int __float2int_rn ( float  x )

Convert a float to a signed integer in round-to-nearest-even mode. Convert the single-precision floating point value x to a signed integer in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ int __float2int_ru ( float )

Convert a float to a signed integer in round-up mode. Convert the single-precision floating point value x to a signed integer in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ int __float2int_rz ( float  x )

Convert a float to a signed integer in round-towards-zero mode. Convert the single-precision floating point value x to a signed integer in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ long long int __float2ll_rd ( float  x )

Convert a float to a signed 64-bit integer in round-down mode. Convert the single-precision floating point value x to a signed 64-bit integer in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ long long int __float2ll_rn ( float  x )

Convert a float to a signed 64-bit integer in round-to-nearest-even mode. Convert the single-precision floating point value x to a signed 64-bit integer in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ long long int __float2ll_ru ( float  x )

Convert a float to a signed 64-bit integer in round-up mode. Convert the single-precision floating point value x to a signed 64-bit integer in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ long long int __float2ll_rz ( float  x )

Convert a float to a signed 64-bit integer in round-towards-zero mode. Convert the single-precision floating point value x to a signed 64-bit integer in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ unsigned int __float2uint_rd ( float  x )

Convert a float to an unsigned integer in round-down mode. Convert the single-precision floating point value x to an unsigned integer in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned int __float2uint_rn ( float  x )

Convert a float to an unsigned integer in round-to-nearest-even mode. Convert the single-precision floating point value x to an unsigned integer in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ unsigned int __float2uint_ru ( float  x )

Convert a float to an unsigned integer in round-up mode. Convert the single-precision floating point value x to an unsigned integer in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned int __float2uint_rz ( float  x )

Convert a float to an unsigned integer in round-towards-zero mode. Convert the single-precision floating point value x to an unsigned integer in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __float2ull_rd ( float  x )

Convert a float to an unsigned 64-bit integer in round-down mode. Convert the single-precision floating point value x to an unsigned 64-bit integer in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __float2ull_rn ( float  x )

Convert a float to an unsigned 64-bit integer in round-to-nearest-even mode. Convert the single-precision floating point value x to an unsigned 64-bit integer in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __float2ull_ru ( float  x )

Convert a float to an unsigned 64-bit integer in round-up mode. Convert the single-precision floating point value x to an unsigned 64-bit integer in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ unsigned long long int __float2ull_rz ( float  x )

Convert a float to an unsigned 64-bit integer in round-towards-zero mode. Convert the single-precision floating point value x to an unsigned 64-bit integer in round-towards_zero mode.

Returns

Returns converted value.

__device__ ​ int __float_as_int ( float  x )

Reinterpret bits in a float as a signed integer. Reinterpret the bits in the single-precision floating point value x as a signed integer.

Returns

Returns reinterpreted value.

__device__ ​ float __half2float ( unsigned short x )

Convert a half-precision float to a single-precision float in round-to-nearest-even mode. Convert the half-precision floating point value x represented in unsigned short format to a single-precision floating point value.

Returns

Returns converted value.

__device__ ​ double __hiloint2double ( int  hi, int  lo )

Reinterpret high and low 32-bit integer values as a double. Reinterpret the integer value of hi as the high 32 bits of a double-precision floating point value and the integer value of lo as the low 32 bits of the same double-precision floating point value.

Returns

Returns reinterpreted value.

__device__ ​ double __int2double_rn ( int  x )

Convert a signed int to a double. Convert the signed integer value x to a double-precision floating point value.

Returns

Returns converted value.

__device__ ​ float __int2float_rd ( int  x )

Convert a signed integer to a float in round-down mode. Convert the signed integer value x to a single-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ float __int2float_rn ( int  x )

Convert a signed integer to a float in round-to-nearest-even mode. Convert the signed integer value x to a single-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ float __int2float_ru ( int  x )

Convert a signed integer to a float in round-up mode. Convert the signed integer value x to a single-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ float __int2float_rz ( int  x )

Convert a signed integer to a float in round-towards-zero mode. Convert the signed integer value x to a single-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ float __int_as_float ( int  x )

Reinterpret bits in an integer as a float. Reinterpret the bits in the signed integer value x as a single-precision floating point value.

Returns

Returns reinterpreted value.

__device__ ​ double __ll2double_rd ( long long int x )

Convert a signed 64-bit int to a double in round-down mode. Convert the signed 64-bit integer value x to a double-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ double __ll2double_rn ( long long int x )

Convert a signed 64-bit int to a double in round-to-nearest-even mode. Convert the signed 64-bit integer value x to a double-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ double __ll2double_ru ( long long int x )

Convert a signed 64-bit int to a double in round-up mode. Convert the signed 64-bit integer value x to a double-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ double __ll2double_rz ( long long int x )

Convert a signed 64-bit int to a double in round-towards-zero mode. Convert the signed 64-bit integer value x to a double-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ float __ll2float_rd ( long long int x )

Convert a signed integer to a float in round-down mode. Convert the signed integer value x to a single-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ float __ll2float_rn ( long long int x )

Convert a signed 64-bit integer to a float in round-to-nearest-even mode. Convert the signed 64-bit integer value x to a single-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ float __ll2float_ru ( long long int x )

Convert a signed integer to a float in round-up mode. Convert the signed integer value x to a single-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ float __ll2float_rz ( long long int x )

Convert a signed integer to a float in round-towards-zero mode. Convert the signed integer value x to a single-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ double __longlong_as_double ( long long int x )

Reinterpret bits in a 64-bit signed integer as a double. Reinterpret the bits in the 64-bit signed integer value x as a double-precision floating point value.

Returns

Returns reinterpreted value.

__device__ ​ double __uint2double_rn ( unsigned int  x )

Convert an unsigned int to a double. Convert the unsigned integer value x to a double-precision floating point value.

Returns

Returns converted value.

__device__ ​ float __uint2float_rd ( unsigned int  x )

Convert an unsigned integer to a float in round-down mode. Convert the unsigned integer value x to a single-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ float __uint2float_rn ( unsigned int  x )

Convert an unsigned integer to a float in round-to-nearest-even mode. Convert the unsigned integer value x to a single-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ float __uint2float_ru ( unsigned int  x )

Convert an unsigned integer to a float in round-up mode. Convert the unsigned integer value x to a single-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ float __uint2float_rz ( unsigned int  x )

Convert an unsigned integer to a float in round-towards-zero mode. Convert the unsigned integer value x to a single-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ double __ull2double_rd ( unsigned long long int x )

Convert an unsigned 64-bit int to a double in round-down mode. Convert the unsigned 64-bit integer value x to a double-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ double __ull2double_rn ( unsigned long long int x )

Convert an unsigned 64-bit int to a double in round-to-nearest-even mode. Convert the unsigned 64-bit integer value x to a double-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ double __ull2double_ru ( unsigned long long int x )

Convert an unsigned 64-bit int to a double in round-up mode. Convert the unsigned 64-bit integer value x to a double-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ double __ull2double_rz ( unsigned long long int x )

Convert an unsigned 64-bit int to a double in round-towards-zero mode. Convert the unsigned 64-bit integer value x to a double-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

__device__ ​ float __ull2float_rd ( unsigned long long int x )

Convert an unsigned integer to a float in round-down mode. Convert the unsigned integer value x to a single-precision floating point value in round-down (to negative infinity) mode.

Returns

Returns converted value.

__device__ ​ float __ull2float_rn ( unsigned long long int x )

Convert an unsigned integer to a float in round-to-nearest-even mode. Convert the unsigned integer value x to a single-precision floating point value in round-to-nearest-even mode.

Returns

Returns converted value.

__device__ ​ float __ull2float_ru ( unsigned long long int x )

Convert an unsigned integer to a float in round-up mode. Convert the unsigned integer value x to a single-precision floating point value in round-up (to positive infinity) mode.

Returns

Returns converted value.

__device__ ​ float __ull2float_rz ( unsigned long long int x )

Convert an unsigned integer to a float in round-towards-zero mode. Convert the unsigned integer value x to a single-precision floating point value in round-towards-zero mode.

Returns

Returns converted value.

Notice

ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY, "MATERIALS") ARE BEING PROVIDED "AS IS." NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.

Information furnished is believed to be accurate and reliable. However, NVIDIA Corporation assumes no responsibility for the consequences of use of such information or for any infringement of patents or other rights of third parties that may result from its use. No license is granted by implication of otherwise under any patent rights of NVIDIA Corporation. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all other information previously supplied. NVIDIA Corporation products are not authorized as critical components in life support devices or systems without express written approval of NVIDIA Corporation.

Trademarks

NVIDIA and the NVIDIA logo are trademarks or registered trademarks of NVIDIA Corporation in the U.S. and other countries. Other company and product names may be trademarks of the respective companies with which they are associated.