0.2 + 0.1 === 0.3 // => false
0.1 + 0.1 === 0.2 // => true
答案:
- http://0.30000000000000004.com/
- 0.1 + 0.1 是向左位移 1 位。
9999999999999999.0 - 9999999999999998.0 // => 2
http://geocar.sdf1.org/numbers.html
为什么是 2 呢?
0.2 + 0.1 === 0.3 // => false
0.1 + 0.1 === 0.2 // => true
答案:
9999999999999999.0 - 9999999999999998.0 // => 2
http://geocar.sdf1.org/numbers.html
为什么是 2 呢?