CUDA Math API (PDF) - v9.0.176 (older) - Last updated September 2, 2017 - Send Feedback

## 1.1.7. Half2 Math Functions

## [Half Precision Intrinsics]

### Functions

__device__ ​ __half2 h2ceil ( const __half2 h )
  Calculate `half2` vector ceiling of the input argument.
__device__ ​ __half2 h2cos ( const __half2 a )
  Calculates `half2` vector cosine in round-to-nearest-even mode.
__device__ ​ __half2 h2exp ( const __half2 a )
  Calculates `half2` vector exponential function in round-to-nearest mode.
__device__ ​ __half2 h2exp10 ( const __half2 a )
  Calculates `half2` vector decimal exponential function in round-to-nearest-even mode.
__device__ ​ __half2 h2exp2 ( const __half2 a )
  Calculates `half2` vector binary exponential function in round-to-nearest-even mode.
__device__ ​ __half2 h2floor ( const __half2 h )
  Calculate the largest integer less than or equal to `h`.
__device__ ​ __half2 h2log ( const __half2 a )
  Calculates `half2` vector natural logarithm in round-to-nearest-even mode.
__device__ ​ __half2 h2log10 ( const __half2 a )
  Calculates `half2` vector decimal logarithm in round-to-nearest-even mode.
__device__ ​ __half2 h2log2 ( const __half2 a )
  Calculates `half2` vector binary logarithm in round-to-nearest-even mode.
__device__ ​ __half2 h2rcp ( const __half2 a )
  Calculates `half2` vector reciprocal in round-to-nearest-even mode.
__device__ ​ __half2 h2rint ( const __half2 h )
  Round input to nearest integer value in half-precision floating point number.
__device__ ​ __half2 h2rsqrt ( const __half2 a )
  Calculates `half2` vector reciprocal square root in round-to-nearest mode.
__device__ ​ __half2 h2sin ( const __half2 a )
  Calculates `half2` vector sine in round-to-nearest-even mode.
__device__ ​ __half2 h2sqrt ( const __half2 a )
  Calculates `half2` vector square root in round-to-nearest-even mode.
__device__ ​ __half2 h2trunc ( const __half2 h )
  Truncate `half2` vector input argument to the integral part.

### Functions

__device__ ​ __half2 h2ceil ( const __half2 h )
  Calculate `half2` vector ceiling of the input argument.

  ###### Returns

  Returns `half2` vector ceiling expressed as a pair of half-precision floating point numbers.

  ###### Description

  For each component of vector `h` compute the smallest integer value not less than `h`.

__device__ ​ __half2 h2cos ( const __half2 a )
  Calculates `half2` vector cosine in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` cosine of vector `a`.

  ###### Description

  Calculates `half2` cosine of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2exp ( const __half2 a )
  Calculates `half2` vector exponential function in round-to-nearest mode.

  ###### Returns

  Returns `half2` exponential function of vector `a`.

  ###### Description

  Calculates `half2` exponential function of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2exp10 ( const __half2 a )
  Calculates `half2` vector decimal exponential function in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` decimal exponential function of vector `a`.

  ###### Description

  Calculates `half2` decimal exponential function of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2exp2 ( const __half2 a )
  Calculates `half2` vector binary exponential function in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` binary exponential function of vector `a`.

  ###### Description

  Calculates `half2` binary exponential function of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2floor ( const __half2 h )
  Calculate the largest integer less than or equal to `h`.

  ###### Returns

  Returns `half2` vector floor expressed as a pair of half-precision floating point number.

  ###### Description

  For each component of vector `h` calculate the largest integer value which is less than or equal to `h`.

__device__ ​ __half2 h2log ( const __half2 a )
  Calculates `half2` vector natural logarithm in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` natural logarithm of vector `a`.

  ###### Description

  Calculates `half2` natural logarithm of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2log10 ( const __half2 a )
  Calculates `half2` vector decimal logarithm in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` decimal logarithm of vector `a`.

  ###### Description

  Calculates `half2` decimal logarithm of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2log2 ( const __half2 a )
  Calculates `half2` vector binary logarithm in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` binary logarithm of vector `a`.

  ###### Description

  Calculates `half2` binary logarithm of input vector `a` in round-to-nearest mode.

__device__ ​ __half2 h2rcp ( const __half2 a )
  Calculates `half2` vector reciprocal in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` reciprocal of vector `a`.

  ###### Description

  Calculates `half2` reciprocal of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2rint ( const __half2 h )
  Round input to nearest integer value in half-precision floating point number.

  ###### Returns

  Returns `half2` vector of rounded integer values expressed as half-precision floating point numbers.

  ###### Description

  Round each component of `half2` vector `h` to the nearest integer value in half-precision floating point format, with halfway cases rounded to the nearest even integer value.

__device__ ​ __half2 h2rsqrt ( const __half2 a )
  Calculates `half2` vector reciprocal square root in round-to-nearest mode.

  ###### Returns

  Returns `half2` reciprocal square root of vector `a`.

  ###### Description

  Calculates `half2` reciprocal square root of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2sin ( const __half2 a )
  Calculates `half2` vector sine in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` sine of vector `a`.

  ###### Description

  Calculates `half2` sine of input vector `a` in round-to-nearest-even mode.

__device__ ​ __half2 h2sqrt ( const __half2 a )
  Calculates `half2` vector square root in round-to-nearest-even mode.

  ###### Returns

  Returns `half2` square root of vector `a`.

  ###### Description

  Calculates `half2` square root of input vector `a` in round-to-nearest mode.

__device__ ​ __half2 h2trunc ( const __half2 h )
  Truncate `half2` vector input argument to the integral part.

  ###### Returns

  Returns `half2` vector truncated integer value.

  ###### Description

  Round each component of vector `h` to the nearest integer value that does not exceed `h` in magnitude.