5 ms·
It's more than just zero. Every number can be represented in multiple ways in DEC64. For example, you could represent 3 as 3 x 10^0 or 30 x 10^-1
by nickodell 7y ago
It's more than just zero. Every number can be represented in multiple ways in DEC64. For example, you could represent 3 as
3 x 10^0
or
30 x 10^-1
- Veedrac 7y agoNo, most numbers have only a single representation. A tenth have two, a hundredth have three, etc.
- lvh 7y agoSmall numbers with many representations are much more common than the full width ones.
- Veedrac 7y agoThis is true, but hardly important. Multiple representations hurt because they waste space, not because they're transiently evil. If you're scared of normalizing before comparisons, or somesuch, nothing stops you normalizing around operations instead, like standard binary floats. Only you'd probably be shooting yourself in the foot, since you'd probably end up normalizing more and making the ‘integers are fast’ claim fail.
- hedora 7y agoIf you have to normalize DEC64 values, then the whole point of this format (1 cycle overhead for common “integer” operations on x64) evaporates. (In fairness, for small integers, the operators over normalized values are closed — they always return normalized values)
- Veedrac 7y agoThat was my point, yes. Being unnormalized is a good thing. IEEE does the same thing for their decimals. > (In fairness, for small integers, the operators over normalized values are closed — they always return normalized values) Normally normalization refers to using the smallest possible exponent; in this light small integers are unnormalized.