1.9.1. Half Arithmetic Functions

[Half Precision Intrinsics]

Functions

__CUDA_FP16_DECL__ __half __hadd ( const __half a, const __half b )
Performs half addition in round-to-nearest mode.
__CUDA_FP16_DECL__ __half __hadd_sat ( const __half a, const __half b )
Performs half addition in round-to-nearest mode, with saturation to [0.0, 1.0].
__CUDA_FP16_DECL__ __half __hfma ( const __half a, const __half b, const __half c )
Performs half fused multiply-add in round-to-nearest mode.
__CUDA_FP16_DECL__ __half __hfma_sat ( const __half a, const __half b, const __half c )
Performs half fused multiply-add in round-to-nearest mode, with saturation to [0.0, 1.0].
__CUDA_FP16_DECL__ __half __hmul ( const __half a, const __half b )
Performs half multiplication in round-to-nearest mode.
__CUDA_FP16_DECL__ __half __hmul_sat ( const __half a, const __half b )
Performs half multiplication in round-to-nearest mode, with saturation to [0.0, 1.0].
__CUDA_FP16_DECL__ __half __hneg ( const __half a )
Negates input half number and returns the result.
__CUDA_FP16_DECL__ __half __hsub ( const __half a, const __half b )
Performs half subtraction in round-to-nearest mode.
__CUDA_FP16_DECL__ __half __hsub_sat ( const __half a, const __half b )
Performs half subtraction in round-to-nearest mode, with saturation to [0.0, 1.0].

Functions

__CUDA_FP16_DECL__ __half __hadd ( const __half a, const __half b )
Performs half addition in round-to-nearest mode.
Returns

Returns the half result of adding a and b.

Description

Performs half addition of inputs a and b, in round-to-nearest mode.

__CUDA_FP16_DECL__ __half __hadd_sat ( const __half a, const __half b )
Performs half addition in round-to-nearest mode, with saturation to [0.0, 1.0].
Returns

Returns the half result of adding a and b with saturation.

Description

Performs half add of inputs a and b, in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

__CUDA_FP16_DECL__ __half __hfma ( const __half a, const __half b, const __half c )
Performs half fused multiply-add in round-to-nearest mode.
Returns

Returns the half result of the fused multiply-add operation on a, b, and c.

Description

Performs half multiply on inputs a and b, then performs a half add of the result with c, rounding the result once in round-to-nearest mode.

__CUDA_FP16_DECL__ __half __hfma_sat ( const __half a, const __half b, const __half c )
Performs half fused multiply-add in round-to-nearest mode, with saturation to [0.0, 1.0].
Returns

Returns the half result of the fused multiply-add operation on a, b, and c with saturation.

Description

Performs half multiply on inputs a and b, then performs a half add of the result with c, rounding the result once in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

__CUDA_FP16_DECL__ __half __hmul ( const __half a, const __half b )
Performs half multiplication in round-to-nearest mode.
Returns

Returns the half result of multiplying a and b.

Description

Performs half multiplication of inputs a and b, in round-to-nearest mode.

__CUDA_FP16_DECL__ __half __hmul_sat ( const __half a, const __half b )
Performs half multiplication in round-to-nearest mode, with saturation to [0.0, 1.0].
Returns

Returns the half result of multiplying a and b with saturation.

Description

Performs half multiplication of inputs a and b, in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

__CUDA_FP16_DECL__ __half __hneg ( const __half a )
Negates input half number and returns the result.
Returns

Returns negated half input a.

Description

Negates input half number and returns the result.

__CUDA_FP16_DECL__ __half __hsub ( const __half a, const __half b )
Performs half subtraction in round-to-nearest mode.
Returns

Returns the half result of subtraction b from a.

Description

Subtracts half input b from input a in round-to-nearest mode.

__CUDA_FP16_DECL__ __half __hsub_sat ( const __half a, const __half b )
Performs half subtraction in round-to-nearest mode, with saturation to [0.0, 1.0].
Returns

Returns the half result of subtraction b from a with saturation.

Description

Subtracts half input b from input a in round-to-nearest mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.