Possible Duplicate:
Is double Multiplication Broken in .NET?
JavaScript code:
var n = 1;
while ( n > 0 )
{
n -= 0.1;
document.body.innerHTML += n + "<br/>";
}
I expected:
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
But got this:
0.9
0.8
0.7000000000000001
0.6000000000000001
0.5000000000000001
0.40000000000000013
0.30000000000000016
0.20000000000000015
0.10000000000000014
1.3877787807814457e-16
-0.09999999999999987
Could anyone explain what's going on there?