Why 100 == 99.999 is true, however 100 == 99.99 is false in Javascript?
3 Answers
What Every Computer Scientist Should Know About Floating Point Arithmetic
and the shorter, more to the point:
Comments
Where are you getting that result?
From Firebug console in Firefox 3.6.3
>>> 100==99.99
false
>>> 100==99.999
false
>>> 100==99.9999
false
>>> 100==99.99999
false
>>> 100==99.999999
false
>>> 100==99.9999999
false
>>> 100==99.99999999
false
>>> 100==99.999999999
false
>>> 100==99.9999999999
false
>>> 100==99.99999999999
false
>>> 100==99.999999999999
false
>>> 100==99.9999999999999
false
>>> 100==99.99999999999999
false
>>> 100==99.999999999999999
true
1 Comment
harpo
@airbai, now you have two problems :)