1.4. Double Precision Mathematical Functions

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  y, double  x )
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__ ​ __CUDA_MATH_CRTIMP 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 × π .
__device__ ​ __CUDA_MATH_CRTIMP double cyl_bessel_i0 ( double  x )
Calculate the value of the regular modified cylindrical Bessel function of order 0 for the input argument.
__device__ ​ __CUDA_MATH_CRTIMP double cyl_bessel_i1 ( double  x )
Calculate the value of the regular modified cylindrical Bessel function of order 1 for the input argument.
__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 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 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__ ​ __CUDA_MATH_CRTIMP 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 × 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__ ​ __CUDA_MATH_CRTIMP double frexp ( double  x, int* nptr )
Extract mantissa and exponent of a floating-point value.
__device__ ​_ACRTIMP 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__ ​ __RETURN_TYPE isfinite ( double  a )
Determine whether argument is finite.
__device__ ​ __RETURN_TYPE isinf ( double  a )
Determine whether argument is infinite.
__device__ ​ __RETURN_TYPE isnan ( double  a )
Determine whether argument is a NaN.
__device__ ​ __CUDA_MATH_CRTIMP double j0 ( double  x )
Calculate the value of the Bessel function of the first kind of order 0 for the input argument.
__device__ ​ __CUDA_MATH_CRTIMP double j1 ( double  x )
Calculate the value of the Bessel function of the first kind of order 1 for the input argument.
__device__ ​ __CUDA_MATH_CRTIMP 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__ ​ __CUDA_MATH_CRTIMP double ldexp ( double  x, int  exp )
Calculate the value of x 2 e x p .
__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 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 l o g e ( 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__ ​ __CUDA_MATH_CRTIMP 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 norm ( int  dim, const double* t )
Calculate the square root of the sum of squares of any number of coordinates.
__device__ ​ __CUDA_MATH_CRTIMP double norm3d ( double  a, double  b, double  c )
Calculate the square root of the sum of squares of three coordinates of the argument.
__device__ ​ __CUDA_MATH_CRTIMP double norm4d ( double  a, double  b, double  c, double  d )
Calculate the square root of the sum of squares of four coordinates of the 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 rhypot ( double  x, double  y )
Calculate one over the square root of the sum of squares of two arguments.
__device__ ​ double rint ( double  x )
Round to nearest integer value in floating-point.
__device__ ​ double rnorm ( int  dim, const double* t )
Calculate the reciprocal of square root of the sum of squares of any number of coordinates.
__device__ ​ double rnorm3d ( double  a, double  b, double  c )
Calculate one over the square root of the sum of squares of three coordinates of the argument.
__device__ ​ double rnorm4d ( double  a, double  b, double  c, double  d )
Calculate one over the square root of the sum of squares of four coordinates of the argument.
__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__ ​ __RETURN_TYPE 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 × π .
__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 × π .
__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__ ​ __CUDA_MATH_CRTIMP double y0 ( double  x )
Calculate the value of the Bessel function of the second kind of order 0 for the input argument.
__device__ ​ __CUDA_MATH_CRTIMP double y1 ( double  x )
Calculate the value of the Bessel function of the second kind of order 1 for the input argument.
__device__ ​ __CUDA_MATH_CRTIMP 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.
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].

Description

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 D.1, Table 7.

__device__ ​ double acosh ( double  x )
Calculate the nonnegative arc hyperbolic cosine of the input argument.
Returns

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

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

Description

Calculate the nonnegative arc hyperbolic cosine of the input argument x.

Note:

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

__device__ ​ double asin ( double  x )
Calculate the arc sine of the input argument.
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].

Description

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 D.1, Table 7.

__device__ ​ double asinh ( double  x )
Calculate the arc hyperbolic sine of the input argument.
Returns

  • asinh(0) returns 1.

Description

Calculate the arc hyperbolic sine of the input argument x.

Note:

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

__device__ ​ double atan ( double  x )
Calculate the arc tangent of the input argument.
Returns

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

  • atan(0) returns +0.

Description

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 D.1, Table 7.

__device__ ​ double atan2 ( double  y, double  x )
Calculate the arc tangent of the ratio of first and second input arguments.
Returns

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

  • atan2(0, 1) returns +0.

Description

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

Note:

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

__device__ ​ double atanh ( double  x )
Calculate the arc hyperbolic tangent of the input argument.
Returns

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

Description

Calculate the arc hyperbolic tangent of the input argument x.

Note:

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

__device__ ​ double cbrt ( double  x )
Calculate the cube root of the input argument.
Returns

Returns x 1 / 3 .

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

Description

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

Note:

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

__device__ ​ __CUDA_MATH_CRTIMP double ceil ( double  x )
Calculate ceiling of the input argument.
Returns

Returns x expressed as a floating-point number.

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

Description

Compute the smallest integer value not less than x.

__device__ ​ double copysign ( double  x, double  y )
Create value with given magnitude, copying sign of second value.
Returns

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

Description

Create a floating-point value with the magnitude x and the sign of y.

__device__ ​ double cos ( double  x )
Calculate the cosine of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double cosh ( double  x )
Calculate the hyperbolic cosine of the input argument.
Returns

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

Description

Calculate the hyperbolic cosine of the input argument x.

Note:

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

__device__ ​ double cospi ( double  x )
Calculate the cosine of the input argument × π .
Returns

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

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double cyl_bessel_i0 ( double  x )
Calculate the value of the regular modified cylindrical Bessel function of order 0 for the input argument.
Returns

Returns the value of the regular modified cylindrical Bessel function of order 0.

Description

Calculate the value of the regular modified cylindrical Bessel function of order 0 for the input argument x, I 0 ( x ) .

Note:

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

__device__ ​ __CUDA_MATH_CRTIMP double cyl_bessel_i1 ( double  x )
Calculate the value of the regular modified cylindrical Bessel function of order 1 for the input argument.
Returns

Returns the value of the regular modified cylindrical Bessel function of order 1.

Description

Calculate the value of the regular modified cylindrical Bessel function of order 1 for the input argument x, I 1 ( x ) .

Note:

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

__device__ ​ double erf ( double  x )
Calculate the error function of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double erfc ( double  x )
Calculate the complementary error function of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double erfcinv ( double  y )
Calculate the inverse complementary error function of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double erfcx ( double  x )
Calculate the scaled complementary error function of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double erfinv ( double  y )
Calculate the inverse error function of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double exp ( double  x )
Calculate the base e exponential of the input argument.
Returns

Returns e x .

Description

Calculate the base e exponential of the input argument x.

Note:

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

__device__ ​ double exp10 ( double  x )
Calculate the base 10 exponential of the input argument.
Returns

Returns 10 x .

Description

Calculate the base 10 exponential of the input argument x.

Note:

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

__device__ ​ double exp2 ( double  x )
Calculate the base 2 exponential of the input argument.
Returns

Returns 2 x .

Description

Calculate the base 2 exponential of the input argument x.

Note:

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

__device__ ​ double expm1 ( double  x )
Calculate the base e exponential of the input argument, minus 1.
Returns

Returns e x 1 .

Description

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 D.1, Table 7.

__device__ ​ double fabs ( double  x )
Calculate the absolute value of the input argument.
Returns

Returns the absolute value of the input argument.

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

Description

Calculate the absolute value of the input argument x.

Note:

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

__device__ ​ double fdim ( double  x, double  y )
Compute the positive difference between x and y.
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.

Description

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 D.1, Table 6.

__device__ ​ __CUDA_MATH_CRTIMP double floor ( double  x )
Calculate the largest integer less than or equal to x.
Returns

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

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

Description

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 D.1, Table 7.

__device__ ​ double fma ( double  x, double  y, double  z )
Compute x × y + z as a single operation.
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 .

Description

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 D.1, Table 7.

__device__ ​ double fmax ( double , double )
Determine the maximum numeric value of the arguments.
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.

Description

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 D.1, Table 7.

__device__ ​ double fmin ( double  x, double  y )
Determine the minimum numeric value of the arguments.
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.

Description

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 D.1, Table 7.

__device__ ​ double fmod ( double  x, double  y )
Calculate the floating-point remainder of x / y.
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.

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double frexp ( double  x, int* nptr )
Extract mantissa and exponent of a floating-point value.
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.

Description

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 D.1, Table 7.

__device__ ​_ACRTIMP double hypot ( double  x, double  y )
Calculate the square root of the sum of squares of two arguments.
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.

Description

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 D.1, Table 7.

__device__ ​ int ilogb ( double  x )
Compute the unbiased integer exponent of the argument.
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.

Description

Calculates the unbiased integer exponent of the input argument x.

Note:

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

__device__ ​ __RETURN_TYPE isfinite ( double  a )
Determine whether argument is finite.
Returns

  • With Visual Studio 2013 host compiler: __RETURN_TYPE is 'bool'. Returns true if and only if a is a finite value.
  • With other host compilers: __RETURN_TYPE is 'int'. Returns a nonzero value if and only if a is a finite value.

Description

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

__device__ ​ __RETURN_TYPE isinf ( double  a )
Determine whether argument is infinite.
Returns

  • With Visual Studio 2013 host compiler: Returns true if and only if a is a infinite value.
  • With other host compilers: Returns a nonzero value if and only if a is a infinite value.

Description

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

__device__ ​ __RETURN_TYPE isnan ( double  a )
Determine whether argument is a NaN.
Returns

  • With Visual Studio 2013 host compiler: __RETURN_TYPE is 'bool'. Returns true if and only if a is a NaN value.
  • With other host compilers: __RETURN_TYPE is 'int'. Returns a nonzero value if and only if a is a NaN value.

Description

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

__device__ ​ __CUDA_MATH_CRTIMP double j0 ( double  x )
Calculate the value of the Bessel function of the first kind of order 0 for the input argument.
Returns

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

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

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double j1 ( double  x )
Calculate the value of the Bessel function of the first kind of order 1 for the input argument.
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.

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double jn ( int  n, double  x )
Calculate the value of the Bessel function of the first kind of order n for the input argument.
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.

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double ldexp ( double  x, int  exp )
Calculate the value of x 2 e x p .
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double lgamma ( double  x )
Calculate the natural logarithm of the absolute value of the gamma function of the input argument.
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 and x is an integer.
  • lgamma( ) returns .
  • lgamma( + ) returns + .

Description

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 D.1, Table 7.

__device__ ​ long long int llrint ( double  x )
Round input to nearest integer value.
Returns

Returns rounded integer value.

Description

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.

__device__ ​ long long int llround ( double  x )
Round to nearest integer value.
Returns

Returns rounded integer value.

Description

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().

__device__ ​ double log ( double  x )
Calculate the base e logarithm of the input argument.
Returns

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

Description

Calculate the base e logarithm of the input argument x.

Note:

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

__device__ ​ double log10 ( double  x )
Calculate the base 10 logarithm of the input argument.
Returns

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

Description

Calculate the base 10 logarithm of the input argument x.

Note:

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

__device__ ​ double log1p ( double  x )
Calculate the value of l o g e ( 1 + x ) .
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double log2 ( double  x )
Calculate the base 2 logarithm of the input argument.
Returns

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

Description

Calculate the base 2 logarithm of the input argument x.

Note:

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

__device__ ​ double logb ( double  x )
Calculate the floating point representation of the exponent of the input argument.
Returns

  • logb ± 0 returns
  • logb ± returns +

Description

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 D.1, Table 7.

__device__ ​ long int lrint ( double  x )
Round input to nearest integer value.
Returns

Returns rounded integer value.

Description

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.

__device__ ​ long int lround ( double  x )
Round to nearest integer value.
Returns

Returns rounded integer value.

Description

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().

__device__ ​ __CUDA_MATH_CRTIMP double modf ( double  x, double* iptr )
Break down the input argument into fractional and integral parts.
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.

Description

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 D.1, Table 7.

__device__ ​ double nan ( const char* tagp )
Returns "Not a Number" value.
Returns

  • nan(tagp) returns NaN.

Description

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 D.1, Table 7.

__device__ ​ double nearbyint ( double  x )
Round the input argument to the nearest integer.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double nextafter ( double  x, double  y )
Return next representable double-precision floating-point value after argument.
Returns

  • nextafter( ± , y) returns ± .

Description

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 D.1, Table 7.

__device__ ​ double norm ( int  dim, const double* t )
Calculate the square root of the sum of squares of any number of coordinates.
Returns

Returns the length of the dim-D vector p.1 2 + p.2 2 + ... + p.dim 2 . If the correct value would overflow, returns + . If the correct value would underflow, returns 0. If two of the input arguments is 0, returns remaining argument

Description

Calculate the length of a vector p, dimension of which is passed as an argument without undue overflow or underflow.

Note:

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

__device__ ​ __CUDA_MATH_CRTIMP double norm3d ( double  a, double  b, double  c )
Calculate the square root of the sum of squares of three coordinates of the argument.
Returns

Returns the length of 3D vector p.x 2 + p.y 2 + p.z 2 . If the correct value would overflow, returns + . If the correct value would underflow, returns 0.

Description

Calculate the length of three dimensional vector p in euclidean space without undue overflow or underflow.

Note:

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

__device__ ​ __CUDA_MATH_CRTIMP double norm4d ( double  a, double  b, double  c, double  d )
Calculate the square root of the sum of squares of four coordinates of the argument.
Returns

Returns the length of 4D vector p.x 2 + p.y 2 + p.z 2 + p.t 2 . If the correct value would overflow, returns + . If the correct value would underflow, returns 0.

Description

Calculate the length of four dimensional vector p in euclidean space without undue overflow or underflow.

Note:

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

__device__ ​ double normcdf ( double  y )
Calculate the standard normal cumulative distribution function.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double normcdfinv ( double  y )
Calculate the inverse of the standard normal cumulative distribution function.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double pow ( double  x, double  y )
Calculate the value of first argument to the power of second argument.
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.

Description

Calculate the value of x to the power of y

Note:

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

__device__ ​ double rcbrt ( double  x )
Calculate reciprocal cube root function.
Returns

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

Description

Calculate reciprocal cube root function of x

Note:

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

__device__ ​ double remainder ( double  x, double  y )
Compute double-precision floating-point remainder.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double remquo ( double  x, double  y, int* quo )
Compute double-precision floating-point remainder and part of quotient.
Returns

Returns the remainder.

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

Description

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 D.1, Table 7.

__device__ ​ double rhypot ( double  x, double  y )
Calculate one over the square root of the sum of squares of two arguments.
Returns

Returns one over the length of the hypotenuse 1 x 2 + y 2 . If the square root would overflow, returns 0. If the square root would underflow, returns + .

Description

Calculate one over 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 D.1, Table 7.

__device__ ​ double rint ( double  x )
Round to nearest integer value in floating-point.
Returns

Returns rounded integer value.

Description

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

__device__ ​ double rnorm ( int  dim, const double* t )
Calculate the reciprocal of square root of the sum of squares of any number of coordinates.
Returns

Returns one over the length of the vector 1 p.1 2 + p.2 2 + ... + p.dim 2 . If the square root would overflow, returns 0. If the square root would underflow, returns + .

Description

Calculates one over the length of vector p, dimension of which is passed as an agument, in euclidean space without undue overflow or underflow.

Note:

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

__device__ ​ double rnorm3d ( double  a, double  b, double  c )
Calculate one over the square root of the sum of squares of three coordinates of the argument.
Returns

Returns one over the length of the 3D vetor 1 p.x 2 + p.y 2 + p.z 2 . If the square root would overflow, returns 0. If the square root would underflow, returns + .

Description

Calculate one over the length of three dimensional vector p in euclidean space undue overflow or underflow.

Note:

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

__device__ ​ double rnorm4d ( double  a, double  b, double  c, double  d )
Calculate one over the square root of the sum of squares of four coordinates of the argument.
Returns

Returns one over the length of the 3D vetor 1 p.x 2 + p.y 2 + p.z 2 + p.t 2 . If the square root would overflow, returns 0. If the square root would underflow, returns + .

Description

Calculate one over the length of four dimensional vector p in euclidean space undue overflow or underflow.

Note:

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

__device__ ​ double round ( double  x )
Round to nearest integer value in floating-point.
Returns

Returns rounded integer value.

Description

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().

__device__ ​ double rsqrt ( double  x )
Calculate the reciprocal of the square root of the input argument.
Returns

Returns 1 / x .

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

Description

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 D.1, Table 7.

__device__ ​ double scalbln ( double  x, long int  n )
Scale floating-point input by integer power of two.
Returns

Returns x * 2 n .

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

Description

Scale x by 2 n by efficient manipulation of the floating-point exponent.

__device__ ​ double scalbn ( double  x, int  n )
Scale floating-point input by integer power of two.
Returns

Returns x * 2 n .

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

Description

Scale x by 2 n by efficient manipulation of the floating-point exponent.

__device__ ​ __RETURN_TYPE signbit ( double  a )
Return the sign bit of the input.
Returns

Reports the sign bit of all values including infinities, zeros, and NaNs.

  • With Visual Studio 2013 host compiler: __RETURN_TYPE is 'bool'. Returns true if and only if a is negative.
  • With other host compilers: __RETURN_TYPE is 'int'. Returns a nonzero value if and only if a is negative.

Description

Determine whether the floating-point value a is negative.

__device__ ​ double sin ( double  x )
Calculate the sine of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ void sincos ( double  x, double* sptr, double* cptr )
Calculate the sine and cosine of the first input argument.
Returns

  • none

Description

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 D.1, Table 7.

__device__ ​ void sincospi ( double  x, double* sptr, double* cptr )
Calculate the sine and cosine of the first input argument × π .
Returns

  • none

Description

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 D.1, Table 7.

__device__ ​ double sinh ( double  x )
Calculate the hyperbolic sine of the input argument.
Returns

  • sinh( ± 0 ) returns ± 0 .

Description

Calculate the hyperbolic sine of the input argument x.

Note:

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

__device__ ​ double sinpi ( double  x )
Calculate the sine of the input argument × π .
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double sqrt ( double  x )
Calculate the square root of the input argument.
Returns

Returns x .

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

Description

Calculate the nonnegative square root of x, x .

Note:

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

__device__ ​ double tan ( double  x )
Calculate the tangent of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double tanh ( double  x )
Calculate the hyperbolic tangent of the input argument.
Returns

  • tanh( ± 0 ) returns ± 0 .

Description

Calculate the hyperbolic tangent of the input argument x.

Note:

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

__device__ ​ double tgamma ( double  x )
Calculate the gamma function of the input argument.
Returns

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

Description

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 D.1, Table 7.

__device__ ​ double trunc ( double  x )
Truncate input argument to the integral part.
Returns

Returns truncated integer value.

Description

Round x to the nearest integer value that does not exceed x in magnitude.

__device__ ​ __CUDA_MATH_CRTIMP double y0 ( double  x )
Calculate the value of the Bessel function of the second kind of order 0 for the input argument.
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.

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double y1 ( double  x )
Calculate the value of the Bessel function of the second kind of order 1 for the input argument.
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.

Description

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 D.1, Table 7.

__device__ ​ __CUDA_MATH_CRTIMP double yn ( int  n, double  x )
Calculate the value of the Bessel function of the second kind of order n for the input argument.
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.

Description

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 D.1, Table 7.