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

I suspect COBOL got this "right"...

In C#, (0.3m - 0.2m) == (0.2m - 0.1m). The latest version of the C++ spec allows for user-defined literals, so you could do something similar there (with caveats). But as far as I know, there's no modern language in widespread use that has decimal literals which default to base-ten representations.




Some SQL implementations seem to. In Postgres:

  test=# select (0.3 - 0.2) - 0.1;
   ?column? 
  ----------
        0.0
  (1 row)
(Ruby gives me -2.77555756156289e-17)




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: