4 ms·
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
by CurtHagenlocher 14y ago
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.
- rst 14y agoSome 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)