My point is that floats *are* Proper Integers: up to 53 bits they can represent every possible integer, and beyond that they can represent certain integers (but those integers, they represent exactly). JS is printing a *different* integer than what the float represents.
-
This Tweet is unavailable.
-
-
Replying to @marcan42 @robertbak
Sure, it's repeatable, and it round-trips, but it's just /wrong/. If the float has a given value, and you print a *different* value, as an integer (not a decimal number that is obviously rounded), that's just messed up. Sure, you can *define* it that way, but still.
1 reply 0 retweets 0 likes -
Replying to @marcan42 @robertbak
Heck, even recent discussion and change to the BigInt spec agree: large Numbers are well-defined as integers. It's ridiculous that converting a Number to a BigInt (which is a safe operation) will change the number that is returned by toString.https://github.com/tc39/proposal-bigint/pull/138 …
0 replies 0 retweets 0 likes -
This Tweet is unavailable.
-
You deleted a tweet about 4611686018427388000 converting to the same number as BigInt. I can't test it because Chrome is using an older version of the draft that forbids that, but nope. Converting what JS calls 4611686018427388000 to BigInt would yield 4611686018427387904n.
1 reply 0 retweets 0 likes -
This Tweet is unavailable.
-
Yes, I linked to that algorithm before in other threads. That algorithm is the problem, and it's stupid and nonsensical. The threshold to break out into e-notation (step 9) should be earlier, instead of padding with trailing zeroes (step 6). No other language does this.
1 reply 0 retweets 0 likes -
This Tweet is unavailable.
-
But Python doesn't do either of those when converting to a string, it uses 1.000000000000001e+18. That's *both* natural *and* makes the loss of precision clear. A number without a decimal point is *not* obviously not actually a precise integer to non-tech people.
1 reply 0 retweets 1 like
In JS, BigInt(1000000000000001000) == 1000000000000001024u so that's no different from Python anyway. This is all just about the default string conversion hiding a surprise behind what looks like a straight integer in JS.
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.