Possible Duplicate:
Is JavaScript's Math broken?
Why can't decimal numbers be represented exactly in binary?
What will be result of next code:
if(0.3 == ( 0.1 + 0.1 + 0.1 ))
{
alert(true);
}
else
{
alert(false);
}
It is strange, but result will be false.
Reason is that result of
0.1+0.1+0.1
will be
0.30000000000000004
How can be explained this behavior?
The explanation is pretty simple – read about Floating Point Numbers Problems