1727 days ago
0.3 - 0.2 == 0.2 - 0.1 is falsy. Which language ge...
thing to do would be to forbid the usage of == for
1.0 == 0.9 -> Throw err 1.0 > 0.9 -> true
In most case, you don't want to use == on
because it 's very dangerous... it's way better to use (0.3 - 0.3000001) < 0.001 or something similar. So, by forbidding the == on
, you force the programmer to use a safer way. In the same time, it's a
around this decimal issue. As a bonus, a programmer who doesn't know binaries arithmetic might get curious on why == isn't implemented on double and read on it.
Apply to YC