CUDA Math API (PDF) - v9.1.85 (older) - Last updated November 3, 2017 - Send Feedback

## 1.1.3. Half Comparison Functions

## [Half Precision Intrinsics]

### Functions

__device__ ​ bool __heq ( const __half a, const __half b )
  Performs `half` if-equal comparison.
__device__ ​ bool __hequ ( const __half a, const __half b )
  Performs `half` unordered if-equal comparison.
__device__ ​ bool __hge ( const __half a, const __half b )
  Performs `half` greater-equal comparison.
__device__ ​ bool __hgeu ( const __half a, const __half b )
  Performs `half` unordered greater-equal comparison.
__device__ ​ bool __hgt ( const __half a, const __half b )
  Performs `half` greater-than comparison.
__device__ ​ bool __hgtu ( const __half a, const __half b )
  Performs `half` unordered greater-than comparison.
__device__ ​ int __hisinf ( const __half a )
  Checks if the input `half` number is infinite.
__device__ ​ bool __hisnan ( const __half a )
  Determine whether `half` argument is a NaN.
__device__ ​ bool __hle ( const __half a, const __half b )
  Performs `half` less-equal comparison.
__device__ ​ bool __hleu ( const __half a, const __half b )
  Performs `half` unordered less-equal comparison.
__device__ ​ bool __hlt ( const __half a, const __half b )
  Performs `half` less-than comparison.
__device__ ​ bool __hltu ( const __half a, const __half b )
  Performs `half` unordered less-than comparison.
__device__ ​ bool __hne ( const __half a, const __half b )
  Performs `half` not-equal comparison.
__device__ ​ bool __hneu ( const __half a, const __half b )
  Performs `half` unordered not-equal comparison.

### Functions

__device__ ​ bool __heq ( const __half a, const __half b )
  Performs `half` if-equal comparison.

  ###### Returns

  Returns boolean result of if-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` if-equal comparison of inputs `a` and `b`. NaN inputs generate false results.

__device__ ​ bool __hequ ( const __half a, const __half b )
  Performs `half` unordered if-equal comparison.

  ###### Returns

  Returns boolean result of unordered if-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` if-equal comparison of inputs `a` and `b`. NaN inputs generate true results.

__device__ ​ bool __hge ( const __half a, const __half b )
  Performs `half` greater-equal comparison.

  ###### Returns

  Returns boolean result of greater-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` greater-equal comparison of inputs `a` and `b`. NaN inputs generate false results.

__device__ ​ bool __hgeu ( const __half a, const __half b )
  Performs `half` unordered greater-equal comparison.

  ###### Returns

  Returns boolean result of unordered greater-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` greater-equal comparison of inputs `a` and `b`. NaN inputs generate true results.

__device__ ​ bool __hgt ( const __half a, const __half b )
  Performs `half` greater-than comparison.

  ###### Returns

  Returns boolean result of greater-than comparison of `a` and `b`.

  ###### Description

  Performs `half` greater-than comparison of inputs `a` and `b`. NaN inputs generate false results.

__device__ ​ bool __hgtu ( const __half a, const __half b )
  Performs `half` unordered greater-than comparison.

  ###### Returns

  Returns boolean result of unordered greater-than comparison of `a` and `b`.

  ###### Description

  Performs `half` greater-than comparison of inputs `a` and `b`. NaN inputs generate true results.

__device__ ​ int __hisinf ( const __half a )
  Checks if the input `half` number is infinite.

  ###### Returns

  Returns -1 iff `a` is equal to negative infinity, 1 iff `a` is equal to positive infinity and 0 otherwise.

  ###### Description

  Checks if the input `half` number `a` is infinite.

__device__ ​ bool __hisnan ( const __half a )
  Determine whether `half` argument is a NaN.

  ###### Returns

  Returns boolean true iff argument is a NaN, boolean false otherwise.

  ###### Description

  Determine whether `half` value `a` is a NaN.

__device__ ​ bool __hle ( const __half a, const __half b )
  Performs `half` less-equal comparison.

  ###### Returns

  Returns boolean result of less-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` less-equal comparison of inputs `a` and `b`. NaN inputs generate false results.

__device__ ​ bool __hleu ( const __half a, const __half b )
  Performs `half` unordered less-equal comparison.

  ###### Returns

  Returns boolean result of unordered less-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` less-equal comparison of inputs `a` and `b`. NaN inputs generate true results.

__device__ ​ bool __hlt ( const __half a, const __half b )
  Performs `half` less-than comparison.

  ###### Returns

  Returns boolean result of less-than comparison of `a` and `b`.

  ###### Description

  Performs `half` less-than comparison of inputs `a` and `b`. NaN inputs generate false results.

__device__ ​ bool __hltu ( const __half a, const __half b )
  Performs `half` unordered less-than comparison.

  ###### Returns

  Returns boolean result of unordered less-than comparison of `a` and `b`.

  ###### Description

  Performs `half` less-than comparison of inputs `a` and `b`. NaN inputs generate true results.

__device__ ​ bool __hne ( const __half a, const __half b )
  Performs `half` not-equal comparison.

  ###### Returns

  Returns boolean result of not-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` not-equal comparison of inputs `a` and `b`. NaN inputs generate false results.

__device__ ​ bool __hneu ( const __half a, const __half b )
  Performs `half` unordered not-equal comparison.

  ###### Returns

  Returns boolean result of unordered not-equal comparison of `a` and `b`.

  ###### Description

  Performs `half` not-equal comparison of inputs `a` and `b`. NaN inputs generate true results.