Hello everyone! Just like subject!Why the result is not 110 and 111,but 110.00000000000001 etc? Why the capability of Javascript's Math is poor?
I Think Therefore I Am
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35257
7
posted
0
It's not JavaScript that's poor at math, it's computers in general. The reason is that math is performed base 2, not base 10, and few floating point numbers have an exact representation in base 2. All the details (which apply to all languages, not just Java or JavaScript) can be found in two articles linked in #20 in the Java Beginners FAQ.