29 ms·
Short, but seems an appropriate response given the lack of explanation in the linked article. IEEE 754 double-precision (64-bit) can only represent even number
by no_protocol 10y ago
Short, but seems an appropriate response given the lack of explanation in the linked article.
IEEE 754 double-precision (64-bit) can only represent even numbers in the range 2^53 to 2^54.
Haskell lets us look inside them fairly easily:
> exponent 9999999999999999.0
54
> significand 9999999999999999.0
0.5551115123125783
> exponent 9999999999999998.0
54
> significand 9999999999999998.0
0.5551115123125782
> 2^54 * 0.5551115123125783
1.0e16
> 2^54 * 0.5551115123125782
9.999999999999998e15
- ubernostrum 10y agoPython also makes it easy to see what's going on in the REPL: >>> 9999999999999999.0 1e+16