JavaScript处理大数字(BigNum)的标准解决方案是什么? [英] What is the standard solution in JavaScript for handling big numbers (BigNum)?

查看:181
本文介绍了JavaScript处理大数字(BigNum)的标准解决方案是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有用于JavaScript或内置的bignum库,我可以包含

Is there a bignum library for JavaScript or built-in that I can include like

<script type="text/javascript" src="the_bignum_library.js"></script>

我想我的用户会喜欢在网页中输入数字并等待7秒以获得结果,而不是下载可执行文件并点击一堆此可执行文件可能会损害您的计算机警告屏幕进行安装。

I think my users would prefer to enter numbers in a web page and wait 7 seconds for a result, rather than download an executable and click through a bunch of "this executable could possibly harm your computer" warning screens to install it.

我考虑过基于 http://github.com/silentmatt / javascript-biginteger http://www.mainebrook.com/john/有趣/ euler.html 。或者你会建议从JavaScript调用Java bignum库,如apfloat?

I've considered basing my own off of http://github.com/silentmatt/javascript-biginteger or http://www.mainebrook.com/john/fun/euler.html. Or would you recommend calling from JavaScript into a Java bignum library such as apfloat?

推荐答案

如果你需要任意精度的十进制数,使用 Javascript-bignum 。这表示数字为十进制数字序列。

If you need arbitrary-precision decimal numbers, use Javascript-bignum. This represents numbers as a sequence of decimal digits.

这篇关于JavaScript处理大数字(BigNum)的标准解决方案是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆