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?

仅有的幸福
仅有的幸福

reply all(2)
伊谢尔伦

Accuracy error, use s.toFixed(2)

phpcn_u1582

Because js has errors when performing decimal operations

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template