You do not understand floating point numbers. 2^53 is not the largest integer that can be represented accurately in 64-bit floats. *All* the integers *from zero to 2^53* can be represented, but *many more larger than that* can too. Just not all of them.
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).
-
-
try `0x4000000000000000n` ;) ... the 'n' is important atm
-
Yes, my point is that BigInt's conversion (once relaxed; the standard got changed recently to allow converting floating-point integers >2^53) proves that the real underlying integer behind the float value is 4611686018427387904, not 4611686018427388000.
- 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.