CUDA Math API (PDF) - v10.0.130 (older) - Last updated August 25, 2018 - Send Feedback

## 1.1.4. Half2 Comparison Functions

## [Half Precision Intrinsics]

To use these functions include the header file `cuda_fp16.h` in your program.

### Functions

__device__ ​ bool __hbeq2 ( const __half2 a, const __half2 b )
  Performs `half2` vector if-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbequ2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered if-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbge2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbgeu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbgt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbgtu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hble2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbleu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hblt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbltu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbne2 ( const __half2 a, const __half2 b )
  Performs `half2` vector not-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ bool __hbneu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered not-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.
__device__ ​ __half2 __heq2 ( const __half2 a, const __half2 b )
  Performs half2 vector if-equal comparison.
__device__ ​ __half2 __hequ2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered if-equal comparison.
__device__ ​ __half2 __hge2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-equal comparison.
__device__ ​ __half2 __hgeu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-equal comparison.
__device__ ​ __half2 __hgt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-than comparison.
__device__ ​ __half2 __hgtu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-than comparison.
__device__ ​ __half2 __hisnan2 ( const __half2 a )
  Determine whether `half2` argument is a NaN.
__device__ ​ __half2 __hle2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-equal comparison.
__device__ ​ __half2 __hleu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-equal comparison.
__device__ ​ __half2 __hlt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-than comparison.
__device__ ​ __half2 __hltu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-than comparison.
__device__ ​ __half2 __hne2 ( const __half2 a, const __half2 b )
  Performs `half2` vector not-equal comparison.
__device__ ​ __half2 __hneu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered not-equal comparison.

### Functions

__device__ ​ bool __hbeq2 ( const __half2 a, const __half2 b )
  Performs `half2` vector if-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of if-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector if-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` if-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

__device__ ​ bool __hbequ2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered if-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of unordered if-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector if-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` if-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

__device__ ​ bool __hbge2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of greater-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector greater-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` greater-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

__device__ ​ bool __hbgeu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of unordered greater-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector greater-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` greater-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

__device__ ​ bool __hbgt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of greater-than comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector greater-than comparison of inputs `a` and `b`. The bool result is set to true only if both `half` greater-than comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

__device__ ​ bool __hbgtu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of unordered greater-than comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector greater-than comparison of inputs `a` and `b`. The bool result is set to true only if both `half` greater-than comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

__device__ ​ bool __hble2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of less-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector less-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` less-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

__device__ ​ bool __hbleu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of unordered less-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector less-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` less-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

__device__ ​ bool __hblt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of less-than comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector less-than comparison of inputs `a` and `b`. The bool result is set to true only if both `half` less-than comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

__device__ ​ bool __hbltu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-than comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of unordered less-than comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector less-than comparison of inputs `a` and `b`. The bool result is set to true only if both `half` less-than comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

__device__ ​ bool __hbne2 ( const __half2 a, const __half2 b )
  Performs `half2` vector not-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of not-equal comparison of vectors `a` and `b` are true,

  - false

    otherwise.

  ###### Description

  Performs `half2` vector not-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` not-equal comparisons evaluate to true, or false otherwise. NaN inputs generate false results.

__device__ ​ bool __hbneu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered not-equal comparison, and returns boolean true iff both `half` results are true, boolean false otherwise.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  bool

  - trueif

    both `half` results of unordered not-equal comparison of vectors `a` and `b` are true;

  - falseotherwise.

  ###### Description

  Performs `half2` vector not-equal comparison of inputs `a` and `b`. The bool result is set to true only if both `half` not-equal comparisons evaluate to true, or false otherwise. NaN inputs generate true results.

__device__ ​ __half2 __heq2 ( const __half2 a, const __half2 b )
  Performs half2 vector if-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of if-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector if-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

__device__ ​ __half2 __hequ2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered if-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of unordered if-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector if-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

__device__ ​ __half2 __hge2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of greater-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector greater-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

__device__ ​ __half2 __hgeu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    `half2` vector result of unordered greater-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector greater-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

__device__ ​ __half2 __hgt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector greater-than comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of greater-than comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector greater-than comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

__device__ ​ __half2 __hgtu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered greater-than comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    `half2` vector result of unordered greater-than comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector greater-than comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

__device__ ​ __half2 __hisnan2 ( const __half2 a )
  Determine whether `half2` argument is a NaN.

  ###### Parameters

  `a`
    - half2

  ###### Returns

  half2

  - The

    half2 with the corresponding `half` results set to 1.0 for for NaN, 0.0 otherwise.

  ###### Description

  Determine whether each half of input `half2` number `a` is a NaN.

__device__ ​ __half2 __hle2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    `half2` result of less-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector less-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

__device__ ​ __half2 __hleu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-equal comparison.

  ###### Returns

  half2

  - The

    vector result of unordered less-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector less-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

__device__ ​ __half2 __hlt2 ( const __half2 a, const __half2 b )
  Performs `half2` vector less-than comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    half2 vector result of less-than comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector less-than comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

__device__ ​ __half2 __hltu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered less-than comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of unordered less-than comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector less-than comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.

__device__ ​ __half2 __hne2 ( const __half2 a, const __half2 b )
  Performs `half2` vector not-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of not-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector not-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate false results.

__device__ ​ __half2 __hneu2 ( const __half2 a, const __half2 b )
  Performs `half2` vector unordered not-equal comparison.

  ###### Parameters

  `a`
    - half2
  `b`
    - half2

  ###### Returns

  half2

  - The

    vector result of unordered not-equal comparison of vectors `a` and `b`.

  ###### Description

  Performs `half2` vector not-equal comparison of inputs `a` and `b`. The corresponding `half` results are set to 1.0 for true, or 0.0 for false. NaN inputs generate true results.