16,0.1 + 0.2 != 0.3

2020-06-11  本文已影响0人  r8HZGEmq
toFixed(10)四舍五入为10的数字(舍弃了后面的一部分)
parseFloat((0.1 + 0.2).toFixed(10)) === 0.3 // true

console.log(0.100000000000000002) // 0.1

0.200000000000000002 === 0.2 // true

18位

上一篇 下一篇

猜你喜欢

热点阅读