Post #3429650
2026-06-27 13:06 UTC
Lovely localization bug discovered in Apple iOS Shortcuts just now by @goatsarah
Note that numbers are localized with commas for decimal, and periods for thousands here. This is important.
x = 23816 / 10937 // 2,17756240
Display arctan(x) // 1,5707963
This is not correct.
arctan(2.17756240) == 1.1402940
What's up? Well, if you store your results as JSON strings truncated to 3 decimal places and localized {"x": "1,775"} and your JSON parser isn't locale aware... well, what is arctan(1775)? 🤦♀️
Replies (1)
-
@hikari@social.noyu.me 2026-06-27 14:38
@saramg@fosstodon.org @goatsarah oh that's a classic. this kind of thing is why any new programming language worth its salt does not respect locale settings for the default to-string and from-string methods (unlike, alas, C, PHP, and likely myriad others)