1.3.8. Bfloat162 Math Functions
[Bfloat16 Precision Intrinsics]
To use these functions, include the header file cuda_bf16.h in your program.
Functions
- __device__ __nv_bfloat162 h2ceil ( const __nv_bfloat162 h )
- Calculate nv_bfloat162 vector ceiling of the input argument.
- __device__ __nv_bfloat162 h2cos ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector cosine in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2exp ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector exponential function in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2exp10 ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector decimal exponential function in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2exp2 ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector binary exponential function in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2floor ( const __nv_bfloat162 h )
- Calculate the largest integer less than or equal to h.
- __device__ __nv_bfloat162 h2log ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector natural logarithm in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2log10 ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector decimal logarithm in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2log2 ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector binary logarithm in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2rcp ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector reciprocal in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2rint ( const __nv_bfloat162 h )
- Round input to nearest integer value in nv_bfloat16 floating-point number.
- __device__ __nv_bfloat162 h2rsqrt ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector reciprocal square root in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2sin ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector sine in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2sqrt ( const __nv_bfloat162 a )
- Calculates nv_bfloat162 vector square root in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2trunc ( const __nv_bfloat162 h )
- Truncate nv_bfloat162 vector input argument to the integral part.
Functions
- __device__ __nv_bfloat162 h2ceil ( const __nv_bfloat162 h )
-
Calculate nv_bfloat162 vector ceiling of the input argument.
Parameters
- h
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The vector of smallest integers not less than h.
Description
For each component of vector h compute the smallest integer value not less than h.
- __device__ __nv_bfloat162 h2cos ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector cosine in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise cosine on vector a.
Description
Calculates nv_bfloat162 cosine of input vector a in round-to-nearest-even mode.
NOTE: this function's implementation calls cosf( float) function and is exposed to compiler optimizations. Specifically, --use_fast_math flag changes cosf( float) into an intrinsic __cosf( float), which has less accurate numeric behavior.
- __device__ __nv_bfloat162 h2exp ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector exponential function in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise exponential function on vector a.
Description
Calculates nv_bfloat162 exponential function of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2exp10 ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector decimal exponential function in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise decimal exponential function on vector a.
Description
Calculates nv_bfloat162 decimal exponential function of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2exp2 ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector binary exponential function in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise binary exponential function on vector a.
Description
Calculates nv_bfloat162 binary exponential function of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2floor ( const __nv_bfloat162 h )
-
Calculate the largest integer less than or equal to h.
Parameters
- h
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The vector of largest integers which is less than or equal to h.
Description
For each component of vector h calculate the largest integer value which is less than or equal to h.
- __device__ __nv_bfloat162 h2log ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector natural logarithm in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise natural logarithm on vector a.
Description
Calculates nv_bfloat162 natural logarithm of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2log10 ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector decimal logarithm in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise decimal logarithm on vector a.
Description
Calculates nv_bfloat162 decimal logarithm of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2log2 ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector binary logarithm in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise binary logarithm on vector a.
Description
Calculates nv_bfloat162 binary logarithm of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2rcp ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector reciprocal in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise reciprocal on vector a.
Description
Calculates nv_bfloat162 reciprocal of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2rint ( const __nv_bfloat162 h )
-
Round input to nearest integer value in nv_bfloat16 floating-point number.
Parameters
- h
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The vector of rounded integer values.
Description
Round each component of nv_bfloat162 vector h to the nearest integer value in nv_bfloat16 floating-point format, with bfloat16way cases rounded to the nearest even integer value.
- __device__ __nv_bfloat162 h2rsqrt ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector reciprocal square root in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise reciprocal square root on vector a.
Description
Calculates nv_bfloat162 reciprocal square root of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2sin ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector sine in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise sine on vector a.
Description
Calculates nv_bfloat162 sine of input vector a in round-to-nearest-even mode.
NOTE: this function's implementation calls sinf( float) function and is exposed to compiler optimizations. Specifically, --use_fast_math flag changes sinf( float) into an intrinsic __sinf( float), which has less accurate numeric behavior.
- __device__ __nv_bfloat162 h2sqrt ( const __nv_bfloat162 a )
-
Calculates nv_bfloat162 vector square root in round-to-nearest-even mode.
Parameters
- a
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The elementwise square root on vector a.
Description
Calculates nv_bfloat162 square root of input vector a in round-to-nearest-even mode.
- __device__ __nv_bfloat162 h2trunc ( const __nv_bfloat162 h )
-
Truncate nv_bfloat162 vector input argument to the integral part.
Parameters
- h
- - nv_bfloat162. Is only being read.
Returns
nv_bfloat162
- The truncated h.
Description
Round each component of vector h to the nearest integer value that does not exceed h in magnitude.