9. Double Precision Intrinsics
This section describes double precision intrinsic functions that are only supported in device code.
To use these functions, you do not need to include any additional header file in your program.
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
in round-down mode. - __device__ double __drcp_rn(double x)
-
Compute
in round-to-nearest-even mode. - __device__ double __drcp_ru(double x)
-
Compute
in round-up mode. - __device__ double __drcp_rz(double x)
-
Compute
in round-towards-zero mode. - __device__ double __dsqrt_rd(double x)
-
Compute
in round-down mode. - __device__ double __dsqrt_rn(double x)
-
Compute
in round-to-nearest-even mode. - __device__ double __dsqrt_ru(double x)
-
Compute
in round-up mode. - __device__ double __dsqrt_rz(double x)
-
Compute
in round-towards-zero mode. - __device__ double __dsub_rd(double x, double y)
-
Subtract two floating-point values in round-down mode.
- __device__ double __dsub_rn(double x, double y)
-
Subtract two floating-point values in round-to-nearest-even mode.
- __device__ double __dsub_ru(double x, double y)
-
Subtract two floating-point values in round-up mode.
- __device__ double __dsub_rz(double x, double y)
-
Subtract two floating-point values in round-towards-zero mode.
- __device__ double __fma_rd(double x, double y, double z)
-
Compute
as a single operation in round-down mode. - __device__ double __fma_rn(double x, double y, double z)
-
Compute
as a single operation in round-to-nearest-even mode. - __device__ double __fma_ru(double x, double y, double z)
-
Compute
as a single operation in round-up mode. - __device__ double __fma_rz(double x, double y, double z)
-
Compute
as a single operation in round-towards-zero mode.
9.1. Functions
-
__device__ double __dadd_rd(double x, double y)
-
Add two floating-point values in round-down mode.
Adds two floating-point values
xandyin round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x+y.__dadd_rd(
x,y) is equivalent to __dadd_rd(y,x).__dadd_rd(
x, ) returns for finitex.__dadd_rd(
, ) returns .__dadd_rd(
, ) returns NaN.__dadd_rd(
, ) returns .__dadd_rd(
x,-x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __dadd_rn(double x, double y)
-
Add two floating-point values in round-to-nearest-even mode.
Adds two floating-point values
xandyin round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x+y.__dadd_rn(
x,y) is equivalent to __dadd_rn(y,x).__dadd_rn(
x, ) returns for finitex.__dadd_rn(
, ) returns .__dadd_rn(
, ) returns NaN.__dadd_rn(
, ) returns .__dadd_rn(
x,-x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __dadd_ru(double x, double y)
-
Add two floating-point values in round-up mode.
Adds two floating-point values
xandyin round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x+y.__dadd_ru(
x,y) is equivalent to __dadd_ru(y,x).__dadd_ru(
x, ) returns for finitex.__dadd_ru(
, ) returns .__dadd_ru(
, ) returns NaN.__dadd_ru(
, ) returns .__dadd_ru(
x,-x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __dadd_rz(double x, double y)
-
Add two floating-point values in round-towards-zero mode.
Adds two floating-point values
xandyin round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x+y.__dadd_rz(
x,y) is equivalent to __dadd_rz(y,x).__dadd_rz(
x, ) returns for finitex.__dadd_rz(
, ) returns .__dadd_rz(
, ) returns NaN.__dadd_rz(
, ) returns .__dadd_rz(
x,-x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __ddiv_rd(double x, double y)
-
Divide two floating-point values in round-down mode.
Divides two floating-point values
xbyyin round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
x/y.sign of the quotient
x/yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__ddiv_rd(
, ) returns NaN.__ddiv_rd(
, ) returns NaN.__ddiv_rd(
x, ) returns of appropriate sign for finitex.__ddiv_rd(
,y) returns of appropriate sign for finitey.__ddiv_rd(
x, ) returns of appropriate sign forx .__ddiv_rd(
,y) returns of appropriate sign fory .If either argument is NaN, NaN is returned.
-
__device__ double __ddiv_rn(double x, double y)
-
Divide two floating-point values in round-to-nearest-even mode.
Divides two floating-point values
xbyyin round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
x/y.sign of the quotient
x/yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__ddiv_rn(
, ) returns NaN.__ddiv_rn(
, ) returns NaN.__ddiv_rn(
x, ) returns of appropriate sign for finitex.__ddiv_rn(
,y) returns of appropriate sign for finitey.__ddiv_rn(
x, ) returns of appropriate sign forx .__ddiv_rn(
,y) returns of appropriate sign fory .If either argument is NaN, NaN is returned.
-
__device__ double __ddiv_ru(double x, double y)
-
Divide two floating-point values in round-up mode.
Divides two floating-point values
xbyyin round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
x/y.sign of the quotient
x/yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__ddiv_ru(
, ) returns NaN.__ddiv_ru(
, ) returns NaN.__ddiv_ru(
x, ) returns of appropriate sign for finitex.__ddiv_ru(
,y) returns of appropriate sign for finitey.__ddiv_ru(
x, ) returns of appropriate sign forx .__ddiv_ru(
,y) returns of appropriate sign fory .If either argument is NaN, NaN is returned.
-
__device__ double __ddiv_rz(double x, double y)
-
Divide two floating-point values in round-towards-zero mode.
Divides two floating-point values
xbyyin round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
x/y.sign of the quotient
x/yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__ddiv_rz(
, ) returns NaN.__ddiv_rz(
, ) returns NaN.__ddiv_rz(
x, ) returns of appropriate sign for finitex.__ddiv_rz(
,y) returns of appropriate sign for finitey.__ddiv_rz(
x, ) returns of appropriate sign forx .__ddiv_rz(
,y) returns of appropriate sign fory .If either argument is NaN, NaN is returned.
-
__device__ double __dmul_rd(double x, double y)
-
Multiply two floating-point values in round-down mode.
Multiplies two floating-point values
xandyin round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x*y.sign of the product
x*yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__dmul_rd(
x,y) is equivalent to __dmul_rd(y,x).__dmul_rd(
x, ) returns of appropriate sign forx .__dmul_rd(
, ) returns NaN.__dmul_rd(
,y) returns of appropriate sign for finitey.If either argument is NaN, NaN is returned.
-
__device__ double __dmul_rn(double x, double y)
-
Multiply two floating-point values in round-to-nearest-even mode.
Multiplies two floating-point values
xandyin round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x*y.sign of the product
x*yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__dmul_rn(
x,y) is equivalent to __dmul_rn(y,x).__dmul_rn(
x, ) returns of appropriate sign forx .__dmul_rn(
, ) returns NaN.__dmul_rn(
,y) returns of appropriate sign for finitey.If either argument is NaN, NaN is returned.
-
__device__ double __dmul_ru(double x, double y)
-
Multiply two floating-point values in round-up mode.
Multiplies two floating-point values
xandyin round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x*y.sign of the product
x*yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__dmul_ru(
x,y) is equivalent to __dmul_ru(y,x).__dmul_ru(
x, ) returns of appropriate sign forx .__dmul_ru(
, ) returns NaN.__dmul_ru(
,y) returns of appropriate sign for finitey.If either argument is NaN, NaN is returned.
-
__device__ double __dmul_rz(double x, double y)
-
Multiply two floating-point values in round-towards-zero mode.
Multiplies two floating-point values
xandyin round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x*y.sign of the product
x*yis XOR of the signs ofxandywhen neither inputs nor result are NaN.__dmul_rz(
x,y) is equivalent to __dmul_rz(y,x).__dmul_rz(
x, ) returns of appropriate sign forx .__dmul_rz(
, ) returns NaN.__dmul_rz(
,y) returns of appropriate sign for finitey.If either argument is NaN, NaN is returned.
-
__device__ double __drcp_rd(double x)
-
Compute
in round-down mode.Compute the reciprocal of
xin round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __drcp_rn(double x)
-
Compute
in round-to-nearest-even mode.Compute the reciprocal of
xin round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __drcp_ru(double x)
-
Compute
in round-up mode.Compute the reciprocal of
xin round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __drcp_rz(double x)
-
Compute
in round-towards-zero mode.Compute the reciprocal of
xin round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __dsqrt_rd(double x)
-
Compute
in round-down mode.Compute the square root of
xin round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __dsqrt_rn(double x)
-
Compute
in round-to-nearest-even mode.Compute the square root of
xin round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __dsqrt_ru(double x)
-
Compute
in round-up mode.Compute the square root of
xin round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __dsqrt_rz(double x)
-
Compute
in round-towards-zero mode.Compute the square root of
xin round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
Requires compute capability >= 2.0.
- Returns
-
Returns
.
-
__device__ double __dsub_rd(double x, double y)
-
Subtract two floating-point values in round-down mode.
Subtracts two floating-point values
xandyin round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x-y.__dsub_rd(
,y) returns for finitey.__dsub_rd(
x, ) returns for finitex.__dsub_rd(
, ) returns NaN.__dsub_rd(
, ) returns .__dsub_rd(
, ) returns .__dsub_rd(
x,x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __dsub_rn(double x, double y)
-
Subtract two floating-point values in round-to-nearest-even mode.
Subtracts two floating-point values
xandyin round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x-y.__dsub_rn(
,y) returns for finitey.__dsub_rn(
x, ) returns for finitex.__dsub_rn(
, ) returns NaN.__dsub_rn(
, ) returns .__dsub_rn(
, ) returns .__dsub_rn(
x,x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __dsub_ru(double x, double y)
-
Subtract two floating-point values in round-up mode.
Subtracts two floating-point values
xandyin round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x-y.__dsub_ru(
,y) returns for finitey.__dsub_ru(
x, ) returns for finitex.__dsub_ru(
, ) returns NaN.__dsub_ru(
, ) returns .__dsub_ru(
, ) returns .__dsub_ru(
x,x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __dsub_rz(double x, double y)
-
Subtract two floating-point values in round-towards-zero mode.
Subtracts two floating-point values
xandyin round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
Note
This operation will never be merged into a single multiply-add instruction.
- Returns
-
Returns
x-y.__dsub_rz(
,y) returns for finitey.__dsub_rz(
x, ) returns for finitex.__dsub_rz(
, ) returns NaN.__dsub_rz(
, ) returns .__dsub_rz(
, ) returns .__dsub_rz(
x,x) returns for finitex, including .If either argument is NaN, NaN is returned.
-
__device__ double __fma_rd(double x, double y, double z)
-
Compute
as a single operation in round-down mode.Computes the value of
as a single ternary operation, rounding the result once in round-down (to negative infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
- Returns
-
Returns the rounded value of
as a single operation.__fma_rd(
, ,z) returns NaN.__fma_rd(
, ,z) returns NaN.__fma_rd(
x,y, ) returns NaN if is an exact .__fma_rd(
x,y, ) returns NaN if is an exact .__fma_rd(
x,y, ) returns if is exact .__fma_rd(
x,y, ) returns if is exact .__fma_rd(
x,y,z) returns if is exactly zero and .If either argument is NaN, NaN is returned.
-
__device__ double __fma_rn(double x, double y, double z)
-
Compute
as a single operation in round-to-nearest-even mode.Computes the value of
as a single ternary operation, rounding the result once in round-to-nearest-even mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
- Returns
-
Returns the rounded value of
as a single operation.__fma_rn(
, ,z) returns NaN.__fma_rn(
, ,z) returns NaN.__fma_rn(
x,y, ) returns NaN if is an exact .__fma_rn(
x,y, ) returns NaN if is an exact .__fma_rn(
x,y, ) returns if is exact .__fma_rn(
x,y, ) returns if is exact .__fma_rn(
x,y,z) returns if is exactly zero and .If either argument is NaN, NaN is returned.
-
__device__ double __fma_ru(double x, double y, double z)
-
Compute
as a single operation in round-up mode.Computes the value of
as a single ternary operation, rounding the result once in round-up (to positive infinity) mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
- Returns
-
Returns the rounded value of
as a single operation.__fma_ru(
, ,z) returns NaN.__fma_ru(
, ,z) returns NaN.__fma_ru(
x,y, ) returns NaN if is an exact .__fma_ru(
x,y, ) returns NaN if is an exact .__fma_ru(
x,y, ) returns if is exact .__fma_ru(
x,y, ) returns if is exact .__fma_ru(
x,y,z) returns if is exactly zero and .If either argument is NaN, NaN is returned.
-
__device__ double __fma_rz(double x, double y, double z)
-
Compute
as a single operation in round-towards-zero mode.Computes the value of
as a single ternary operation, rounding the result once in round-towards-zero mode.Note
For accuracy information, see the CUDA C++ Programming Guide, Mathematical Functions Appendix, Intrinsic Functions section.
- Returns
-
Returns the rounded value of
as a single operation.__fma_rz(
, ,z) returns NaN.__fma_rz(
, ,z) returns NaN.__fma_rz(
x,y, ) returns NaN if is an exact .__fma_rz(
x,y, ) returns NaN if is an exact .__fma_rz(
x,y, ) returns if is exact .__fma_rz(
x,y, ) returns if is exact .__fma_rz(
x,y,z) returns if is exactly zero and .If either argument is NaN, NaN is returned.