1.9.1. Half Arithmetic Functions

[Half Precision Intrinsics]

Functions

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

Functions

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

Returns the half result of adding a and b.

Description

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

__device__ ​ __half __hadd_sat ( const __half a, const __half b )
Performs half addition in round-to-nearest-even 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-even mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

__device__ ​ __half __hfma ( const __half a, const __half b, const __half c )
Performs half fused multiply-add in round-to-nearest-even 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-even mode.

__device__ ​ __half __hfma_sat ( const __half a, const __half b, const __half c )
Performs half fused multiply-add in round-to-nearest-even 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-even mode, and clamps the result to range [0.0, 1.0]. NaN results are flushed to +0.0.

__device__ ​ __half __hmul ( const __half a, const __half b )
Performs half multiplication in round-to-nearest-even 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.

__device__ ​ __half __hmul_sat ( const __half a, const __half b )
Performs half multiplication in round-to-nearest-even 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.

__device__ ​ __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.

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

Returns the half result of subtraction b from a.

Description

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

__device__ ​ __half __hsub_sat ( const __half a, const __half b )
Performs half subtraction in round-to-nearest-even 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.

__device__ ​ __half2 h2div ( const __half2 a, const __half2 b )
Performs half2 vector division in round-to-nearest-even mode.
Returns

Returns the half2 vector result of division a by b.

Description

Divides half2 input vector a by input vector b in round-to-nearest mode.

__device__ ​ __half hdiv ( const __half a, const __half b )
Performs half division in round-to-nearest-even mode.
Returns

Returns the half result of division a by b.

Description

Divides half input a by input b in round-to-nearest mode.