Float16 module

half_to_float_fast4

procedure · 1 overloadSource

Converts a half to float32. Every half value is exactly representable, so the conversion is exact: subnormals, signed zero and infinities carry over, and a NaN stays a NaN with its payload.

Called float16_to_float32 too.

ExampleOpen in playground ↗
assert(half_to_float_fast4(cast(Float16) 0x3c00) == 1.0);
assert(half_to_float_fast4(cast(Float16) 0xc000) == -2.0);
assert(half_to_float_fast4(cast(Float16) 0x7bff) == 65504.0);
assert(half_to_float_fast4(cast(Float16) 0x0001) == 5.9604644775390625e-8); // smallest subnormal
half_to_float_fast4 :: (h: Float16) -> float32

Parameters

Returns

float32

See also