Toweave's blog. Power by Gatsby & React.
A starter blog demonstrating what Gatsby can do.
马上订阅 Toweave's blog. Power by Gatsby & React. RSS 更新: https://toweave.github.io/rss.xml
浮点数运算的精度问题
2019年4月1日 18:33
根据浮点数的定义,非整数的 Number 类型无法用 来比较( 也不行) 这里输出的结果是 true,说明两边不相等。
所以正确的比较方法是使用 JavaScript 提供的最小精度值: 小记 JavaScript 中有 +0 和 -…