In memory, an IEEE floating point number consists one sign bit,
- Half-precision
f16
: - Single-precision
f32
:, - Double-precision
f64
:,
Subsections
Bias in Exponents
The exponent is biased. The offset can be computed as
For example, for f32
, it has an offset of
Stored Exponent | Scaling | Meaning |
---|---|---|
0 | Zero (if mantissa = 0), subnormal (otherwise)| | |
1 | ||
… | … | |
127 | ||
… | … | |
254 | ||
255 | N/A | Infinity (if mantissa = 0), NaN (otherwise) |
Similarly, f16
has a bias of f64
has a bias of
Related
- We can use bit operations to isolate sign bit, exponent bits, or mantissa bits