3 ms·
Here's another gem. Compare: (0.1 + 0.2) * 10 (1 + 2)
by teej 18y ago
Here's another gem. Compare:
(0.1 + 0.2) * 10
(1 + 2)
- sharkbrainguy 18y agowhoah... what? surely ... but ... >> (0.1+ 0.2) * 10 3.0000000000000004 >> (0.1 + 0.2 + 0.1) * 10 4 wtf is going on here? Where you would expect 0.3 you just always seem to get 0.3000000000000004 ... but then it "corrects" ... Haunted!
- sharkbrainguy 18y agoso ... it turns out that this is just a property of floating point math... weird that I've never seen that before. It behaves the same in Python and MzScheme, so I can't imagine that this is something "keeping people away" from javascript.