.NET Framework Library for arbitrary digit precision

吃可爱长大的小学妹 提交于 2019-12-18 09:20:49

问题


I'm reviving this question, and making it more specific: Is there a .NET framework library that supports numbers with arbitrary digits of precision?


回答1:


There are a few options here.

A good option is W3b.Sine, which is native C#/.NET, and supports arbitrary precision floating point values.

If you are only dealing with integer values, IntX provides support for arbitrary precision integer values. A potentially more mature option would be C# BigInt, but again, this will not support floating point operations.




回答2:


Can you wait for .NET 4.0? They're bringing BigInteger directly into the Framework.

On the other hand, if you can't wait, then the J# runtime includes built-in support for java.math.BigInteger and BigDecimal. This is redistributable just like the rest of the .NET Framework.




回答3:


You could try the old method of mantissa. Basically you could have an 64 bit integer for storing the number and then a 64 bit integer for storing the exponent (which could be negative). You could build your own object type and overload the arithmetic operators, so it will be treated as a single number. It will require some work, but I think it will be your best option.




回答4:


GnuMpDotNet: http://www.emilstefanov.net/Projects/GnuMpDotNet/

If you need pure .NET consider looking into this: http://www.codeplex.com/IntX/




回答5:


Perhaps surprisingly, the Bailey-Borwein-Plouffe formula gives an incremental procedure for computing the next binary or hexadecimal digit of pi without needing to store all the previous digits.




回答6:


If you want a really fast library then try:

http://www.emilstefanov.net/Projects/GnuMpDotNet/




回答7:


You can use decimal type which gives you 28-29 significant digits




回答8:


Here is a good article on how to represent infinite digits.

http://dobbscodetalk.com/index.php?option=com_myblog&show=Basic-Arithmetic-with-Infinite-Integers.html&Itemid=29

good luck



来源:https://stackoverflow.com/questions/1169673/net-framework-library-for-arbitrary-digit-precision

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!