64bit internal, 53bit external... this has been known for like 20yr
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)
-
Yes, and hilariously, (4611686018427387904).toString() is "4611686018427388000" (the wrong answer), while BigInt(4611686018427388000).toString() is "4611686018427387904" (the right answer) (or it will be once Chrome catches up with the spec, right now it's an error).
- 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.