by librasteve · 2y ago · 0 comments
> A normalized floating-point number has mantissa be a fixed number of digits for a given floating-point type.
well, no. in fact...
> A normalized [binary] floating-point number has mantissa which is bit shifted so that the first bit to the right of the binary point is '1'.
(not a great look in an expert explainer comment)
The significand of a normalized number starts with an implied 1 to the left of the decimal point, which isn’t explicitly represented. In other words, the significand represents the range [1, 2) for normalized numbers.
In fact, that’s reason we need subnormal numbers: they are numbers for which the implied first bit is not 1, so the significand represents the range [0, 1).
Subnormal numbers therefore do not have a fixed number of digits (precision). As subnormals approach zero, the precision gets smaller.
And that’s the key point. A subnormal number does not have the significand/mantissa aligned to start with an (implied) 1. It has leading zeros. Thus the number of digits of a subnormal number is not fixed.
1.0000x10^0 has the same precision as 1.0000x10^-99.
1.0000x10^-99 does not have the same precision as 0.0010x10^-99.
That is why the original poster wrote the subnormals have a not-fixed number of digits.
But if you’re going to go around writing snarky “gotcha” comments, at least try to get your facts straight.