是否有JavaScript的十进制数学库? [英] Is there a decimal math library for JavaScript?

查看:128
本文介绍了是否有JavaScript的十进制数学库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个成熟的库可以在JavaScript中进行基于十进制的数学运算,可能是任意精度的?

Is there a mature library for doing decimal-based math, possibly arbitrary-precision, in JavaScript?

编辑:我想要这个有关浮点相关问题的参考页面的信息以及二进制浮点不合适时使用的替代方法: http: //floating-point-gui.de/

I want this information for a reference page on floating-point-related problems and alternatives to use when binary floating-point is inappropriate: http://floating-point-gui.de/

推荐答案

有一个Java的端口 BigDecimal class(我想它就在这里: http:// freshmeat。 net / projects / js_bigdecimal / 很长一段时间。我很久以前就看过它,看起来很麻烦而且很庞大,但是(如果那是我正在考虑的那个)它已经被用作一些加密工具的一部分,所以它有可能工作正常。

There's been a "port" of the Java BigDecimal class (I think it's here: http://freshmeat.net/projects/js_bigdecimal/ ) for a long time. I looked at it a long time ago and it seemed kind-of cumbersome and huge, but (if that's the one I'm thinking of) it's been used as part of some cryptography tools so there's a decent chance that it works OK.

因为密码学很可能是需要这些东西的地方,所以这是窥探这些软件包的好方法。

Because cryptography is a likely area to generate a need for such things, that's a good way to snoop around for such packages.

编辑:感谢@Daniel(对问题发表评论)这个较旧的SO问题: https://stackoverflow.com/questions/744099/javascript-bigdecimal-library

edit: Thanks @Daniel (comment to question) for this older SO question: https://stackoverflow.com/questions/744099/javascript-bigdecimal-library

这篇关于是否有JavaScript的十进制数学库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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