## Description

The `half`

data type must be IEEE 754-2008 compliant.
`half`

numbers have 1 sign bit, 5 exponent bits, and 10 mantissa bits.
The interpretation of the sign, exponent and mantissa is analogous to IEEE
754 floating-point numbers.
The exponent bias is 15.
The `half`

data type must represent finite and normal numbers, denormalized
numbers, infinities and NaN.
Denormalized numbers for the `half`

data type which may be generated when
converting a `float`

to a `half`

using **vstore_half** and converting a `half`

to a `float`

using **vload_half** cannot be flushed to zero.
Conversions from `float`

to `half`

correctly round the mantissa to 11 bits
of precision.
Conversions from `half`

to `float`

are lossless; all `half`

numbers are
exactly representable as `float`

values.

The `half`

data type can only be used to declare a pointer to a buffer that
contains `half`

values.
A few valid examples are given below:

```
void
bar (__global half *p)
{
...
}
__kernel void
foo (__global half *pg, __local half *pl)
{
__global half *ptr;
int offset;
ptr = pg + offset;
bar(ptr);
}
```

Below are some examples that are not valid usage of the `half`

type:

```
half a;
half b[100];
half *p;
a = *p; // not allowed. must use *vload_half* function
```

Loads from a pointer to a `half`

and stores to a pointer to a `half`

can be
performed using the vector data load
and store functions **vload_half**, **vload_half n**,

**vloada_halfn**and

**vstore_half**,

**vstore_half**, and

*n***vstorea_halfn**. The load functions read scalar or vector

`half`

values from memory and
convert them to a scalar or vector `float`

value.
The store functions take a scalar or vector `float`

value as input, convert
it to a `half`

scalar or vector value (with appropriate rounding mode) and
write the `half`

scalar or vector value to memory.## Document Notes

For more information, see the OpenCL C Specification

This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.