javascript - In the for loop, why is the s output by the expression s+=0.01 not an arithmetic sequence?
仅有的幸福2017-05-16 13:38:57
0
2
637
Logically speaking, the output should be 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 1.00 1.01 Why is the output result like the picture above? Why do so many decimals suddenly appear?
Accuracy error, use
s.toFixed(2)
Because js has errors when performing decimal operations