JavaScript 中处理大数 (BigNum) 的标准解决方案是什么?
JavaScript 或浏览器中是否内置了 bignum?
另一种方法是加载外部库,
<script type="text/javascript" src="the_bignum_library.js"></script>
但这似乎很慢并且可能会触发安全警告。
我考虑过基于 http://github.com/silentmatt/javascript-biginteger 或 http://www.mainebrook.com/john/fun/euler.html 。或者,是否有调用 Java bignum 库(例如 apfloat)的解决方案?
Is there a bignum built into JavaScript or browsers?
The alternate is loading an external library like
<script type="text/javascript" src="the_bignum_library.js"></script>
but that seems slow and may trigger a security warning.
I've considered basing my own off of http://github.com/silentmatt/javascript-biginteger or http://www.mainebrook.com/john/fun/euler.html. Alternately, is the solution to call into a Java bignum library such as apfloat?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新(2019-08-19):BigInt< /a> 现在是 Firefox 和 Chrome 的一部分;你不再需要图书馆:
原始答案:
如果您需要任意精度的十进制数字,请使用 Javascript-bignum,因为它是正确的而且速度快。
Update(2019-08-19): BigInt is now part of Firefox and Chrome; you no longer need a library:
Original answer:
If you need arbitrary-precision decimal numbers, use Javascript-bignum, as it is correct and fast.