小编Har*_*639的帖子

Java Script中的一些大数字问题

这是我面临的一个奇怪问题.当我将一些大数字传递给JS函数(自定义或内置)时,该值会自动增加1.例如,请参阅:

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display an alert box.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
alert(10466511635124471);
}
</script>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

在我看到的警报中10466511635124472,而不是10466511635124471.有人可以解释这种行为吗?

我在FF 17.0.10和Chrome 12.0.742.122以及IE 8中检查了这个.

javascript biginteger

6
推荐指数
1
解决办法
127
查看次数

标签 统计

biginteger ×1

javascript ×1