HalfFloat

The half precision floating point type.

The only operations are:

  • explicit conversion of float to HalfFloat
  • implicit conversion of HalfFloat to float

It operates in an analogous manner to shorts, which are converted to ints before performing any operations, and explicitly cast back to shorts. The half float is considered essentially a storage type, not a computation type.

Alias This

toFloat

Members

Manifest constants

dig
enum dig;
mant_dig
enum mant_dig;
max_10_exp
enum max_10_exp;
max_exp
enum max_exp;
min_10_exp
enum min_10_exp;
min_exp
enum min_exp;

Static functions

epsilon
HalfFloat epsilon()
infinity
HalfFloat infinity()
max
HalfFloat max()
min_normal
HalfFloat min_normal()
nan
HalfFloat nan()

Bugs

The only rounding mode currently supported is Round To Nearest. The exceptions OVERFLOW, UNDERFLOW and INEXACT are not thrown.

Examples

HalfFloat h = hf!27.2f;
HalfFloat j = cast(HalfFloat)( hf!3.5f + hf!5 );
HalfFloat f = HalfFloat(0.0f);

Meta