Intrinsics1 min read
f16tof32
Converts 16-bit floating-point bits to a 32-bit float.
Reading Time
1 min
Word Count
82
Sections
7
Try It Live
Test f16tof32 in a live shader
Open the playground, start from a visual preset, and wire f16tof32 into the fragment stage to see how it behaves with real values.
Open PlaygroundThe f16tof32 function converts a 16-bit floating-point representation stored in a uint back to a 32-bit float.
Live Demo
Signature
bwsl
f16tof32 :: (uint x) -> float
Parameters
| Parameter | Type | Description |
|---|---|---|
x | uint | Half-float bits stored in the low 16 bits |
Return Value
Returns the decoded 32-bit float.
Example
bwsl
uint halfBits = packedValue & 0xffffu;
float value = f16tof32(halfBits);Compiled Output
When compiled portably:
bwsl
unpack_half2x16(x).x
See Also
- f32tof16 - Encode to half-float bits
- pack_half2x16 - Pack two half floats
- unpack_half2x16 - Unpack two half floats