Possible Duplicate:
Is JavaScript’s Floating-Point Math Broken?
For some reason when I'm multiplying numbers, when the number gets larger than 10,000,000 I start to see problems with accuracy. Here's the code:
this.multiply = function(quantity, value, id) {
var math = quantity * value;
document.getElementById(id).value = math.toFixed(2);
}
Here's the values that I get:
11111 -> 11111.00
111111 -> 111111.00
1111111 -> 1111111.04
11111111 -> 11111110.45
111111111 -> 111111116.41
It just gets worse from there. Any idea what could be causing this or how to fix this accuracy problem?