+ 1
Weird division in js
var x =67.2; x/=10; outputs 6.72000000001 how do I keep this from happening?
2 Answers
+ 3
I think u can use [.toFixed(n)] method to determine how many numbers will appear after .
Note : write any number inside the method parantheses
e.g
var x = 67.2
x /= 10;
z = x.toFixed(2)
z = 6.72
+ 1
The key word here is "floating point precision"