Hacker News new | ask | show | jobs
by js2 811 days ago
IEEE 754 can represent integers larger than MAX_SAFE_INTEGER, just not all of them:

https://en.wikipedia.org/wiki/Double-precision_floating-poin...

That's still going to be a greater than 0.1% chance of hitting a non-representable value though.

1 comments

It’s been a long long time. I may be remembering the ratio wrong, or we might have been clipping the range a bit.
> or we might have been clipping the range a bit

Well it's a pretty abrupt change. 53 bits work fine, at 54 bits a quarter of numbers get truncated, at 55 it's half.