Need Arbitrary-Precision-Arithmetic in C#

2019-07-07 02:06发布

问题:

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

回答1:

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.



回答2:

Another alternative that is more liberally licensed than MPIR is the BigInteger class available in the source code for the Bouncycastle C# library.