美文网首页
16,0.1 + 0.2 != 0.3

16,0.1 + 0.2 != 0.3

作者: r8HZGEmq | 来源:发表于2020-06-11 17:20 被阅读0次
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位

相关文章

网友评论

      本文标题:16,0.1 + 0.2 != 0.3

      本文链接:https://www.haomeiwen.com/subject/caabtktx.html