CUDA Math API (PDF) - v9.2.148 (older) - Last updated June 12, 2018 - Send Feedback

## 1.1.5. Half Precision Conversion And Data Movement

## [Half Precision Intrinsics]

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

### Functions

__host__ ​ __device__ ​ __half2 __float22half2_rn ( const float2 a )
  Converts both components of float2 number to half precision in round-to-nearest-even mode and returns `half2` with converted values.
__host__ ​ __device__ ​ __half __float2half ( const float a )
  Converts float number to half precision in round-to-nearest-even mode and returns `half` with converted value.
__host__ ​ __device__ ​ __half2 __float2half2_rn ( const float a )
  Converts input to half precision in round-to-nearest-even mode and populates both halves of `half2` with converted value.
__host__ ​ __device__ ​ __half __float2half_rd ( const float a )
  Converts float number to half precision in round-down mode and returns `half` with converted value.
__host__ ​ __device__ ​ __half __float2half_rn ( const float a )
  Converts float number to half precision in round-to-nearest-even mode and returns `half` with converted value.
__host__ ​ __device__ ​ __half __float2half_ru ( const float a )
  Converts float number to half precision in round-up mode and returns `half` with converted value.
__host__ ​ __device__ ​ __half __float2half_rz ( const float a )
  Converts float number to half precision in round-towards-zero mode and returns `half` with converted value.
__host__ ​ __device__ ​ __half2 __floats2half2_rn ( const float a, const float b )
  Converts both input floats to half precision in round-to-nearest-even mode and returns `half2` with converted values.
__host__ ​ __device__ ​ float2 __half22float2 ( const __half2 a )
  Converts both halves of `half2` to float2 and returns the result.
__host__ ​ __device__ ​ float __half2float ( const __half a )
  Converts `half` number to float.
__device__ ​ __half2 __half2half2 ( const __half a )
  Returns `half2` with both halves equal to the input value.
__device__ ​ int __half2int_rd ( __half h )
  Convert a half to a signed integer in round-down mode.
__device__ ​ int __half2int_rn ( __half h )
  Convert a half to a signed integer in round-to-nearest-even mode.
__device__ ​ int __half2int_ru ( __half h )
  Convert a half to a signed integer in round-up mode.
__device__ ​ int __half2int_rz ( __half h )
  Convert a half to a signed integer in round-towards-zero mode.
__device__ ​ long long int __half2ll_rd ( __half h )
  Convert a half to a signed 64-bit integer in round-down mode.
__device__ ​ long long int __half2ll_rn ( __half h )
  Convert a half to a signed 64-bit integer in round-to-nearest-even mode.
__device__ ​ long long int __half2ll_ru ( __half h )
  Convert a half to a signed 64-bit integer in round-up mode.
__device__ ​ long long int __half2ll_rz ( __half h )
  Convert a half to a signed 64-bit integer in round-towards-zero mode.
__device__ ​ short int __half2short_rd ( __half h )
  Convert a half to a signed short integer in round-down mode.
__device__ ​ short int __half2short_rn ( __half h )
  Convert a half to a signed short integer in round-to-nearest-even mode.
__device__ ​ short int __half2short_ru ( __half h )
  Convert a half to a signed short integer in round-up mode.
__device__ ​ short int __half2short_rz ( __half h )
  Convert a half to a signed short integer in round-towards-zero mode.
__device__ ​ unsigned int __half2uint_rd ( __half h )
  Convert a half to an unsigned integer in round-down mode.
__device__ ​ unsigned int __half2uint_rn ( __half h )
  Convert a half to an unsigned integer in round-to-nearest-even mode.
__device__ ​ unsigned int __half2uint_ru ( __half h )
  Convert a half to an unsigned integer in round-up mode.
__device__ ​ unsigned int __half2uint_rz ( __half h )
  Convert a half to an unsigned integer in round-towards-zero mode.
__device__ ​ unsigned long long int __half2ull_rd ( __half h )
  Convert a half to an unsigned 64-bit integer in round-down mode.
__device__ ​ unsigned long long int __half2ull_rn ( __half h )
  Convert a half to an unsigned 64-bit integer in round-to-nearest-even mode.
__device__ ​ unsigned long long int __half2ull_ru ( __half h )
  Convert a half to an unsigned 64-bit integer in round-up mode.
__device__ ​ unsigned long long int __half2ull_rz ( __half h )
  Convert a half to an unsigned 64-bit integer in round-towards-zero mode.
__device__ ​ unsigned short int __half2ushort_rd ( __half h )
  Convert a half to an unsigned short integer in round-down mode.
__device__ ​ unsigned short int __half2ushort_rn ( __half h )
  Convert a half to an unsigned short integer in round-to-nearest-even mode.
__device__ ​ unsigned short int __half2ushort_ru ( __half h )
  Convert a half to an unsigned short integer in round-up mode.
__device__ ​ unsigned short int __half2ushort_rz ( __half h )
  Convert a half to an unsigned short integer in round-towards-zero mode.
__device__ ​ short int __half_as_short ( const __half h )
  Reinterprets bits in a `half` as a signed short integer.
__device__ ​ unsigned short int __half_as_ushort ( const __half h )
  Reinterprets bits in a `half` as an unsigned short integer.
__device__ ​ __half2 __halves2half2 ( const __half a, const __half b )
  Combines two `half` numbers into one `half2` number.
__host__ ​ __device__ ​ float __high2float ( const __half2 a )
  Converts high 16 bits of `half2` to float and returns the result.
__device__ ​ __half __high2half ( const __half2 a )
  Returns high 16 bits of `half2` input.
__device__ ​ __half2 __high2half2 ( const __half2 a )
  Extracts high 16 bits from `half2` input.
__device__ ​ __half2 __highs2half2 ( const __half2 a, const __half2 b )
  Extracts high 16 bits from each of the two `half2` inputs and combines into one `half2` number.
__device__ ​ __half __int2half_rd ( int i )
  Convert a signed integer to a half in round-down mode.
__device__ ​ __half __int2half_rn ( int i )
  Convert a signed integer to a half in round-to-nearest-even mode.
__device__ ​ __half __int2half_ru ( int i )
  Convert a signed integer to a half in round-up mode.
__device__ ​ __half __int2half_rz ( int i )
  Convert a signed integer to a half in round-towards-zero mode.
__device__ ​ __half __ll2half_rd ( long long int i )
  Convert a signed 64-bit integer to a half in round-down mode.
__device__ ​ __half __ll2half_rn ( long long int i )
  Convert a signed 64-bit integer to a half in round-to-nearest-even mode.
__device__ ​ __half __ll2half_ru ( long long int i )
  Convert a signed 64-bit integer to a half in round-up mode.
__device__ ​ __half __ll2half_rz ( long long int i )
  Convert a signed 64-bit integer to a half in round-towards-zero mode.
__host__ ​ __device__ ​ float __low2float ( const __half2 a )
  Converts low 16 bits of `half2` to float and returns the result.
__device__ ​ __half __low2half ( const __half2 a )
  Returns low 16 bits of `half2` input.
__device__ ​ __half2 __low2half2 ( const __half2 a )
  Extracts low 16 bits from `half2` input.
__device__ ​ __half2 __lowhigh2highlow ( const __half2 a )
  Swaps both halves of the `half2` input.
__device__ ​ __half2 __lows2half2 ( const __half2 a, const __half2 b )
  Extracts low 16 bits from each of the two `half2` inputs and combines into one `half2` number.
__device__ ​ __half __short2half_rd ( short int i )
  Convert a signed short integer to a half in round-down mode.
__device__ ​ __half __short2half_rn ( short int i )
  Convert a signed short integer to a half in round-to-nearest-even mode.
__device__ ​ __half __short2half_ru ( short int i )
  Convert a signed short integer to a half in round-up mode.
__device__ ​ __half __short2half_rz ( short int i )
  Convert a signed short integer to a half in round-towards-zero mode.
__device__ ​ __half __short_as_half ( const short int i )
  Reinterprets bits in a signed short integer as a `half`.
__device__ ​ __half __uint2half_rd ( unsigned int i )
  Convert an unsigned integer to a half in round-down mode.
__device__ ​ __half __uint2half_rn ( unsigned int i )
  Convert an unsigned integer to a half in round-to-nearest-even mode.
__device__ ​ __half __uint2half_ru ( unsigned int i )
  Convert an unsigned integer to a half in round-up mode.
__device__ ​ __half __uint2half_rz ( unsigned int i )
  Convert an unsigned integer to a half in round-towards-zero mode.
__device__ ​ __half __ull2half_rd ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-down mode.
__device__ ​ __half __ull2half_rn ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-to-nearest-even mode.
__device__ ​ __half __ull2half_ru ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-up mode.
__device__ ​ __half __ull2half_rz ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-towards-zero mode.
__device__ ​ __half __ushort2half_rd ( unsigned short int i )
  Convert an unsigned short integer to a half in round-down mode.
__device__ ​ __half __ushort2half_rn ( unsigned short int i )
  Convert an unsigned short integer to a half in round-to-nearest-even mode.
__device__ ​ __half __ushort2half_ru ( unsigned short int i )
  Convert an unsigned short integer to a half in round-up mode.
__device__ ​ __half __ushort2half_rz ( unsigned short int i )
  Convert an unsigned short integer to a half in round-towards-zero mode.
__device__ ​ __half __ushort_as_half ( const unsigned short int i )
  Reinterprets bits in an unsigned short integer as a `half`.

### Functions

__host__ ​ __device__ ​ __half2 __float22half2_rn ( const float2 a )
  Converts both components of float2 number to half precision in round-to-nearest-even mode and returns `half2` with converted values.

  ###### Returns

  Returns `half2` which has corresponding halves equal to the converted float2 components.

  ###### Description

  Converts both components of float2 to half precision in round-to-nearest mode and combines the results into one `half2` number. Low 16 bits of the return value correspond to `a.x` and high 16 bits of the return value correspond to `a.y`.

__host__ ​ __device__ ​ __half __float2half ( const float a )
  Converts float number to half precision in round-to-nearest-even mode and returns `half` with converted value.

  ###### Returns

  Returns `half` result with converted value.

  ###### Description

  Converts float number `a` to half precision in round-to-nearest-even mode.

__host__ ​ __device__ ​ __half2 __float2half2_rn ( const float a )
  Converts input to half precision in round-to-nearest-even mode and populates both halves of `half2` with converted value.

  ###### Returns

  Returns `half2` with both halves equal to the converted half precision number.

  ###### Description

  Converts input `a` to half precision in round-to-nearest-even mode and populates both halves of `half2` with converted value.

__host__ ​ __device__ ​ __half __float2half_rd ( const float a )
  Converts float number to half precision in round-down mode and returns `half` with converted value.

  ###### Returns

  Returns `half` result with converted value.

  ###### Description

  Converts float number `a` to half precision in round-down mode.

__host__ ​ __device__ ​ __half __float2half_rn ( const float a )
  Converts float number to half precision in round-to-nearest-even mode and returns `half` with converted value.

  ###### Returns

  Returns `half` result with converted value.

  ###### Description

  Converts float number `a` to half precision in round-to-nearest-even mode.

__host__ ​ __device__ ​ __half __float2half_ru ( const float a )
  Converts float number to half precision in round-up mode and returns `half` with converted value.

  ###### Returns

  Returns `half` result with converted value.

  ###### Description

  Converts float number `a` to half precision in round-up mode.

__host__ ​ __device__ ​ __half __float2half_rz ( const float a )
  Converts float number to half precision in round-towards-zero mode and returns `half` with converted value.

  ###### Returns

  Returns `half` result with converted value.

  ###### Description

  Converts float number `a` to half precision in round-towards-zero mode.

__host__ ​ __device__ ​ __half2 __floats2half2_rn ( const float a, const float b )
  Converts both input floats to half precision in round-to-nearest-even mode and returns `half2` with converted values.

  ###### Returns

  Returns `half2` which has corresponding halves equal to the converted input floats.

  ###### Description

  Converts both input floats to half precision in round-to-nearest-even mode and combines the results into one `half2` number. Low 16 bits of the return value correspond to the input `a`, high 16 bits correspond to the input `b`.

__host__ ​ __device__ ​ float2 __half22float2 ( const __half2 a )
  Converts both halves of `half2` to float2 and returns the result.

  ###### Returns

  Returns converted float2.

  ###### Description

  Converts both halves of `half2` input `a` to float2 and returns the result.

__host__ ​ __device__ ​ float __half2float ( const __half a )
  Converts `half` number to float.

  ###### Returns

  Returns float result with converted value.

  ###### Description

  Converts half number `a` to float.

__device__ ​ __half2 __half2half2 ( const __half a )
  Returns `half2` with both halves equal to the input value.

  ###### Returns

  Returns `half2` with both halves equal to the input `a`.

  ###### Description

  Returns `half2` number with both halves equal to the input `a` `half` number.

__device__ ​ int __half2int_rd ( __half h )
  Convert a half to a signed integer in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed integer in round-down mode.

__device__ ​ int __half2int_rn ( __half h )
  Convert a half to a signed integer in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed integer in round-to-nearest-even mode.

__device__ ​ int __half2int_ru ( __half h )
  Convert a half to a signed integer in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed integer in round-up mode.

__device__ ​ int __half2int_rz ( __half h )
  Convert a half to a signed integer in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed integer in round-towards-zero mode.

__device__ ​ long long int __half2ll_rd ( __half h )
  Convert a half to a signed 64-bit integer in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed 64-bit integer in round-down mode.

__device__ ​ long long int __half2ll_rn ( __half h )
  Convert a half to a signed 64-bit integer in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed 64-bit integer in round-to-nearest-even mode.

__device__ ​ long long int __half2ll_ru ( __half h )
  Convert a half to a signed 64-bit integer in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed 64-bit integer in round-up mode.

__device__ ​ long long int __half2ll_rz ( __half h )
  Convert a half to a signed 64-bit integer in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed 64-bit integer in round-towards-zero mode.

__device__ ​ short int __half2short_rd ( __half h )
  Convert a half to a signed short integer in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed short integer in round-down mode.

__device__ ​ short int __half2short_rn ( __half h )
  Convert a half to a signed short integer in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed short integer in round-to-nearest-even mode.

__device__ ​ short int __half2short_ru ( __half h )
  Convert a half to a signed short integer in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed short integer in round-up mode.

__device__ ​ short int __half2short_rz ( __half h )
  Convert a half to a signed short integer in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to a signed short integer in round-towards-zero mode.

__device__ ​ unsigned int __half2uint_rd ( __half h )
  Convert a half to an unsigned integer in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned integer in round-down mode.

__device__ ​ unsigned int __half2uint_rn ( __half h )
  Convert a half to an unsigned integer in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned integer in round-to-nearest-even mode.

__device__ ​ unsigned int __half2uint_ru ( __half h )
  Convert a half to an unsigned integer in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned integer in round-up mode.

__device__ ​ unsigned int __half2uint_rz ( __half h )
  Convert a half to an unsigned integer in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned integer in round-towards-zero mode.

__device__ ​ unsigned long long int __half2ull_rd ( __half h )
  Convert a half to an unsigned 64-bit integer in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned 64-bit integer in round-down mode.

__device__ ​ unsigned long long int __half2ull_rn ( __half h )
  Convert a half to an unsigned 64-bit integer in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned 64-bit integer in round-to-nearest-even mode.

__device__ ​ unsigned long long int __half2ull_ru ( __half h )
  Convert a half to an unsigned 64-bit integer in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned 64-bit integer in round-up mode.

__device__ ​ unsigned long long int __half2ull_rz ( __half h )
  Convert a half to an unsigned 64-bit integer in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned 64-bit integer in round-towards-zero mode.

__device__ ​ unsigned short int __half2ushort_rd ( __half h )
  Convert a half to an unsigned short integer in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned short integer in round-down mode.

__device__ ​ unsigned short int __half2ushort_rn ( __half h )
  Convert a half to an unsigned short integer in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned short integer in round-to-nearest-even mode.

__device__ ​ unsigned short int __half2ushort_ru ( __half h )
  Convert a half to an unsigned short integer in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned short integer in round-up mode.

__device__ ​ unsigned short int __half2ushort_rz ( __half h )
  Convert a half to an unsigned short integer in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the half-precision floating point value `h` to an unsigned short integer in round-towards-zero mode.

__device__ ​ short int __half_as_short ( const __half h )
  Reinterprets bits in a `half` as a signed short integer.

  ###### Returns

  Returns reinterpreted value.

  ###### Description

  Reinterprets the bits in the half-precision floating point value `h` as a signed short integer.

__device__ ​ unsigned short int __half_as_ushort ( const __half h )
  Reinterprets bits in a `half` as an unsigned short integer.

  ###### Returns

  Returns reinterpreted value.

  ###### Description

  Reinterprets the bits in the half-precision floating point value `h` as an unsigned short integer.

__device__ ​ __half2 __halves2half2 ( const __half a, const __half b )
  Combines two `half` numbers into one `half2` number.

  ###### Returns

  Returns `half2` number which has one half equal to `a` and the other to `b`.

  ###### Description

  Combines two input `half` number `a` and `b` into one `half2` number. Input `a` is stored in low 16 bits of the return value, input `b` is stored in high 16 bits of the return value.

__host__ ​ __device__ ​ float __high2float ( const __half2 a )
  Converts high 16 bits of `half2` to float and returns the result.

  ###### Returns

  Returns high 16 bits of `a` converted to float.

  ###### Description

  Converts high 16 bits of `half2` input `a` to 32 bit floating point number and returns the result.

__device__ ​ __half __high2half ( const __half2 a )
  Returns high 16 bits of `half2` input.

  ###### Returns

  Returns `half` which contains high 16 bits of the input.

  ###### Description

  Returns high 16 bits of `half2` input `a`.

__device__ ​ __half2 __high2half2 ( const __half2 a )
  Extracts high 16 bits from `half2` input.

  ###### Returns

  Returns `half2` with both halves equal to high 16 bits from the input.

  ###### Description

  Extracts high 16 bits from `half2` input `a` and returns a new `half2` number which has both halves equal to the extracted bits.

__device__ ​ __half2 __highs2half2 ( const __half2 a, const __half2 b )
  Extracts high 16 bits from each of the two `half2` inputs and combines into one `half2` number.

  ###### Returns

  Returns `half2` which contains high 16 bits from `a` and `b`.

  ###### Description

  Extracts high 16 bits from each of the two `half2` inputs and combines into one `half2` number. High 16 bits from input `a` is stored in low 16 bits of the return value, high 16 bits from input `b` is stored in high 16 bits of the return value.

__device__ ​ __half __int2half_rd ( int i )
  Convert a signed integer to a half in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed integer value `i` to a half-precision floating point value in round-down mode.

__device__ ​ __half __int2half_rn ( int i )
  Convert a signed integer to a half in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed integer value `i` to a half-precision floating point value in round-to-nearest-even mode.

__device__ ​ __half __int2half_ru ( int i )
  Convert a signed integer to a half in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed integer value `i` to a half-precision floating point value in round-up mode.

__device__ ​ __half __int2half_rz ( int i )
  Convert a signed integer to a half in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed integer value `i` to a half-precision floating point value in round-towards-zero mode.

__device__ ​ __half __ll2half_rd ( long long int i )
  Convert a signed 64-bit integer to a half in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed 64-bit integer value `i` to a half-precision floating point value in round-down mode.

__device__ ​ __half __ll2half_rn ( long long int i )
  Convert a signed 64-bit integer to a half in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed 64-bit integer value `i` to a half-precision floating point value in round-to-nearest-even mode.

__device__ ​ __half __ll2half_ru ( long long int i )
  Convert a signed 64-bit integer to a half in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed 64-bit integer value `i` to a half-precision floating point value in round-up mode.

__device__ ​ __half __ll2half_rz ( long long int i )
  Convert a signed 64-bit integer to a half in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed 64-bit integer value `i` to a half-precision floating point value in round-towards-zero mode.

__host__ ​ __device__ ​ float __low2float ( const __half2 a )
  Converts low 16 bits of `half2` to float and returns the result.

  ###### Returns

  Returns low 16 bits of `a` converted to float.

  ###### Description

  Converts low 16 bits of `half2` input `a` to 32 bit floating point number and returns the result.

__device__ ​ __half __low2half ( const __half2 a )
  Returns low 16 bits of `half2` input.

  ###### Returns

  Returns `half` which contains low 16 bits of the input.

  ###### Description

  Returns low 16 bits of `half2` input `a`.

__device__ ​ __half2 __low2half2 ( const __half2 a )
  Extracts low 16 bits from `half2` input.

  ###### Returns

  Returns `half2` with both halves equal to low 16 bits from the input.

  ###### Description

  Extracts low 16 bits from `half2` input `a` and returns a new `half2` number which has both halves equal to the extracted bits.

__device__ ​ __half2 __lowhigh2highlow ( const __half2 a )
  Swaps both halves of the `half2` input.

  ###### Returns

  Returns `half2` with halves swapped.

  ###### Description

  Swaps both halves of the `half2` input and returns a new `half2` number with swapped halves.

__device__ ​ __half2 __lows2half2 ( const __half2 a, const __half2 b )
  Extracts low 16 bits from each of the two `half2` inputs and combines into one `half2` number.

  ###### Returns

  Returns `half2` which contains low 16 bits from `a` and `b`.

  ###### Description

  Extracts low 16 bits from each of the two `half2` inputs and combines into one `half2` number. Low 16 bits from input `a` is stored in low 16 bits of the return value, low 16 bits from input `b` is stored in high 16 bits of the return value.

__device__ ​ __half __short2half_rd ( short int i )
  Convert a signed short integer to a half in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed short integer value `i` to a half-precision floating point value in round-down mode.

__device__ ​ __half __short2half_rn ( short int i )
  Convert a signed short integer to a half in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed short integer value `i` to a half-precision floating point value in round-to-nearest-even mode.

__device__ ​ __half __short2half_ru ( short int i )
  Convert a signed short integer to a half in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed short integer value `i` to a half-precision floating point value in round-up mode.

__device__ ​ __half __short2half_rz ( short int i )
  Convert a signed short integer to a half in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the signed short integer value `i` to a half-precision floating point value in round-towards-zero mode.

__device__ ​ __half __short_as_half ( const short int i )
  Reinterprets bits in a signed short integer as a `half`.

  ###### Returns

  Returns reinterpreted value.

  ###### Description

  Reinterprets the bits in the signed short integer value `i` as a half-precision floating point value.

__device__ ​ __half __uint2half_rd ( unsigned int i )
  Convert an unsigned integer to a half in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned integer value `i` to a half-precision floating point value in round-down mode.

__device__ ​ __half __uint2half_rn ( unsigned int i )
  Convert an unsigned integer to a half in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned integer value `i` to a half-precision floating point value in round-to-nearest-even mode.

__device__ ​ __half __uint2half_ru ( unsigned int i )
  Convert an unsigned integer to a half in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned integer value `i` to a half-precision floating point value in round-up mode.

__device__ ​ __half __uint2half_rz ( unsigned int i )
  Convert an unsigned integer to a half in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned integer value `i` to a half-precision floating point value in round-towards-zero mode.

__device__ ​ __half __ull2half_rd ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned 64-bit integer value `i` to a half-precision floating point value in round-down mode.

__device__ ​ __half __ull2half_rn ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned 64-bit integer value `i` to a half-precision floating point value in round-to-nearest-even mode.

__device__ ​ __half __ull2half_ru ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned 64-bit integer value `i` to a half-precision floating point value in round-up mode.

__device__ ​ __half __ull2half_rz ( unsigned long long int i )
  Convert an unsigned 64-bit integer to a half in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned 64-bit integer value `i` to a half-precision floating point value in round-towards-zero mode.

__device__ ​ __half __ushort2half_rd ( unsigned short int i )
  Convert an unsigned short integer to a half in round-down mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned short integer value `i` to a half-precision floating point value in round-down mode.

__device__ ​ __half __ushort2half_rn ( unsigned short int i )
  Convert an unsigned short integer to a half in round-to-nearest-even mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned short integer value `i` to a half-precision floating point value in round-to-nearest-even mode.

__device__ ​ __half __ushort2half_ru ( unsigned short int i )
  Convert an unsigned short integer to a half in round-up mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned short integer value `i` to a half-precision floating point value in round-up mode.

__device__ ​ __half __ushort2half_rz ( unsigned short int i )
  Convert an unsigned short integer to a half in round-towards-zero mode.

  ###### Returns

  Returns converted value.

  ###### Description

  Convert the unsigned short integer value `i` to a half-precision floating point value in round-towards-zero mode.

__device__ ​ __half __ushort_as_half ( const unsigned short int i )
  Reinterprets bits in an unsigned short integer as a `half`.

  ###### Returns

  Returns reinterpreted value.

  ###### Description

  Reinterprets the bits in the unsigned short integer value `i` as a half-precision floating point value.