4 ms·
> There are also 255 representations of almost all representable numbers. Of course ... That's true of any decimal number representation with an exponent. Why
by jamesaguilar 13y ago
> There are also 255 representations of almost all representable numbers.
Of course ... That's true of any decimal number representation with an exponent. Why is it a problem?
- StefanKarpinski 13y agoThat's not true – you could easily pick one of the 255 representations here as the representation and make sure that all operations always produce that one. Then you're still wasting a whole byte of your representation – and one in 255 bit patterns are invalid – but at least you can check for equality using bitwise comparison, and operations don't have to worry about all the possible representation of each value.
- StefanKarpinski 13y agoCorrection: as was pointed out above, there isn't actually a whole byte of waste in this representation. It varies from 255 representations of zero, 17 of 10^-127, to only one representation of numbers that can't be shifted left or right without overflowing or losing bits.