That’s about converting, not displaying. JS can’t represent the integer version, to our mutual annoyance
s=0, b=2, m=1, e=62 (other combinations encode the same number; this definition is prior to the actual binary encoding which maximizes m)pic.twitter.com/bpUSYHdhSp
-
-
That standard uses an interesting way of defining numbers. In any case, JS has chosen its string conversion so that tonumber(tostring(x))==x and the string has a minumum number of significant digits. 754 does not define conversions to string
-
754 defines conversion to integer and common sense says the returned string represents an integer when it's just digits. If you choose to claim it doesn't, then we can agree JS doesn't violate 754, it instead violates common sense and the principle of least surprise.
- 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.