Hacker News new | past | comments | ask | show | jobs | submit login

Here's another gem. Compare:

    (0.1 + 0.2) * 10
    (1 + 2)



whoah... 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!


so ... 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: