C# 中需要任意精度算术
我需要 C# 的浮点计算,可以正确存储最多 500 位数字/小数。是否有任何内置类型,我是否必须自己创建它,任何可用的库或者最好的方法是什么?
谢谢
I'm in need of floating point calculations for C# that can correctly store up to maybe 500 digits/decimals. Is there any built-in-type for this, do I have to create it myself, any library available or what is the best way to go?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MPIR 是 GMP 项目的一个分支,具有 C# 绑定。就我个人而言,我发现在提出问题时它们更容易处理,以至于我不再担心 GMP(主要是因为它在内存不足时倾向于暴力退出)。
此处列出了其他一些内容,但我没有直接使用它们的经验,因此无法发表评论他们的用处。
MPIR, a fork of the GMP project, has C# bindings. Personally, I've found them easier to deal with when raising problems, to the point that I no longer worry about GMP (primarily due to its tendency to exit violently when running out of memory).
There are others listed here but I have no direct experience with them so can't comment on their usefulness.
另一种比 MPIR 更自由许可的替代方案是 Bouncycastle C# 库。
Another alternative that is more liberally licensed than MPIR is the BigInteger class available in the source code for the Bouncycastle C# library.