Also I just stumbled upon this one, and, seriously, I don't even. Who comes up with this stuff?https://twitter.com/marcan42/status/1008999468492918784 …
If it ain't broke, I'll fix it!
I'm porting Linux to Apple Silicon Macs at @AsahiLinux.
http://patreon.com/marcan | http://github.com/sponsors/marcan
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
Add this Tweet to your website by copying the code below. Learn more
Add this video to your website by copying the code below. Learn more
By embedding Twitter content in your website or app, you are agreeing to the Twitter Developer Agreement and Developer Policy.
| Country | Code | For customers of |
|---|---|---|
| United States | 40404 | (any) |
| Canada | 21212 | (any) |
| United Kingdom | 86444 | Vodafone, Orange, 3, O2 |
| Brazil | 40404 | Nextel, TIM |
| Haiti | 40404 | Digicel, Voila |
| Ireland | 51210 | Vodafone, O2 |
| India | 53000 | Bharti Airtel, Videocon, Reliance |
| Indonesia | 89887 | AXIS, 3, Telkomsel, Indosat, XL Axiata |
| Italy | 4880804 | Wind |
| 3424486444 | Vodafone | |
| » See SMS short codes for other countries | ||
This timeline is where you’ll spend most of your time, getting instant updates about what matters to you.
Hover over the profile pic and click the Following button to unfollow any account.
When you see a Tweet you love, tap the heart — it lets the person who wrote it know you shared the love.
The fastest way to share someone else’s Tweet with your followers is with a Retweet. Tap the icon to send it instantly.
Add your thoughts about any Tweet with a Reply. Find a topic you’re passionate about, and jump right in.
Get instant insight into what people are talking about now.
Follow more accounts to get instant updates about topics you care about.
See the latest conversations about any topic instantly.
Catch up instantly on the best stories happening as they unfold.
Hector Martin Retweeted Hector Martin
Also I just stumbled upon this one, and, seriously, I don't even. Who comes up with this stuff?https://twitter.com/marcan42/status/1008999468492918784 …
Hector Martin added,
Js follows IEEE 754, quite sure that's expected behaviour
Hector Martin Retweeted Hector Martin
Nope, it doesn't. This is *specified* in IEEE 754. JS is violating the spec.https://twitter.com/marcan42/status/1009008156322623489 …
Hector Martin added,
I think you’re confused about what double-precision floating-point means. See: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type … https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64 … https://developers.google.com/web/updates/2018/05/bigint … https://mathiasbynens.be/demo/integer-range … For integers, JavaScript uses 53 bits to store the digits and + 1 for the sign.
I think you're confused about what "integer" means. The 64-bit IEEE754 floating point value represented by the (big-endian) bytes 43d0000000000000 *represents* the int 4611686018427387904. It does *not* represent the int 4611686018427388000. The latter is not representable.
You can *round* 4611686018427388000 to the nearest representable integer in that format, which is 4611686018427387904. But there is no reason to conjure up 4611686018427388000 when converting back to integer. That is just wrong and broken.
Yes, the ECMAScript spec says toString must be implemented in this (broken) way. This is insane, and no other sensible language does this. It is misleading and wrong. https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type …
Numbers are floats in Lua <5.3 too, but it never pretends floats are integers that they aren't. Smaller exact-int floats are stringified as integers, then after a threshold (lower than the 53-bit limit) it switches to exp notation. string.format will give you all the digits.pic.twitter.com/cimunNayeM
Ultimately this is a problem of the principle of least surprise. To any reasonable human, a string of digits with no decimal point is an *integer*. However, to JavaScript, it's a *float*. JS is abusing this point to produce unexpected results from toString.
Yes, the output string equals the float when spat back into a JS interpreter, but that's besides the point. It's not what a *human* expects. This is like the people complaining about things like undefined behavior in C. Except the latter is at least often useful for performance.
This stuff hurts people trying to learn the language, because instead of doing what's natural and obvious, things will work until suddenly they don't. The person learning will be bit by bugs, and will be told "that's just the way it is", but it shouldn't *be* that way.
You work on TC39, so suggestion: change toString so that any numbers ≥ 2⁵³ or ≤ -2⁵³ are stringified in e-notation, or, alternatively, with the full integer digit expansion and a trailing ".". This makes it clear when precision is limited, without phantom/incorrect digits.
I doubt that’s feasible. I bet it would break lots of existing code. @littledan
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.