2

It seems a very simple question. the result of parseFloat in IE is different from the results in Chrome and FF. Here is the very simple code

<html>
    <script>
        var lat = parseFloat(" 25.482688176812758");
        alert(lat);
    </script>
    <body>
    </body>
</html>

then try to open it in IE the alert is 25.482688176812757 but in chrome and FF is 25.482688176812758

4

1 回答 1

0

这是数字实现中小数位数的浏览器限制。

一种解决方法是使用库BigDecimal

更多关于JavaScript 的浮点备忘单

于 2014-03-13T17:44:48.710 回答