2 ms·
That depends on how you store it. Each number can be written in infinitely many ways, for example 12, 1.2E1, and 0.012E3 all are “twelve” In (binary) IEEE flo
by Someone 8d ago
That depends on how you store it.
Each number can be written in infinitely many ways, for example 12, 1.2E1, and 0.012E3 all are “twelve”
In (binary) IEEE floats, the canonical way to write floats is
significant × 2^exponent
with 1 ≤ significant < 2. So, “twelve” gets stored as 1.5 × 2³ and not as, for example, 0.375 × 2⁵, 12 × 2⁰ or 96 × 2⁻³.
Float operations normally return numbers satisfying that.
However, in IEEE, the exponent cannot be made arbitrary small. Because of that, some very small numbers cannot be represented that way.
In those cases the standard says operations can return numbers with the value closest to the correct value with a significant less than 1. Those number representations are called subnormals.