Generally, computers store numbers with decimal places as
floating point numbers, which aren't stored exactly.
The Some solutions are
- work with some multiple of the numbers (eg 100 for yours), so you could use $x = 10000; $y = -10001; print $x - $y;
- use printf to round your answer, like so printf "%0.2f", $x+$y