javascript Math.abs()不同的行为

时间:2014-10-22 07:28:32

标签: javascript math numbers

我不明白在这些情况下发生了什么:

Math.abs(40.35 * 100)
->4035
Math.abs(40.36 * 100)
->4036
Math.abs(40.37 * 100)
->4036.9999999999995
Math.abs(40.38 * 100)
->4038.0000000000005
Math.abs(40.39 * 100)
->4039

为什么会这样? 我虽然math.abs()返回绝对值(?)。

非常感谢

编辑* 感谢参考链接,没有找到类似的东西

0 个答案:

没有答案