You are not doing anything, what you see is a side effect of computers storing numbers in base 2. In base 10, 1/3 cannot be exactly represented: .33333333 (with a bar above 3). The same is true for 1/10 and 1/5 in base 2 or binary. The answer you see is simply the result of a rounding error. If you work with money, it is often recommended to store the values as cents to avoid floating point errors.
As for fixing the result, you can do something like:
var SIGDIG= 100000000; alert( Math.floor((-0.2-0.1)*SIGDIG)/SIGDIG );
daalbert
source share