Wrong. The largest int that can be represented exactly in a 64-bit IEEE 754 floating point format is 0x1.fffffffffffffp+1023, which is an exact 309-digit integer that doesn't fit in a tweet, but can be approximated as 1.7976931348623157e+308.
IEEE 754 predates web browsers. It came out in 1985. And besides, IEEE 754 is baked into CPUs anyway, so browsers aren't going to randomly mess it up. The only problem here is JS *lies* when converting to a string.
-
-
No other programming language does this. No other programming language takes a floating-point value representing an integer, and, when converting it to a string, says "you know what, I'm going to give you a different integer, without any indication that rounding has occurred".
-
yeah, i know. i've been dealing with the oddness since the beginning... i'm not trying to defend it, just tried to point you at the 'why'. v8 has bigint now, and so does node 10.4.x afaik, so things are getting better (slowly, very slowly)
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.