Does C# support arbitrary precision arithmetic (I think this is also called bignums)?
If it doesn't, which libraries do support it?
Does C# support arbitrary precision arithmetic (I think this is also called bignums)?
If it doesn't, which libraries do support it?
There is a BigInteger
structure that supports arbitrary-size integers.
http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx
Nothing for floating-point though.
You've already found the big integer; if you need big rational numbers (that is, fractions where the numerator and denominator are big integers) you can use the Rational class from the Solver library:
http://msdn.microsoft.com/en-us/library/microsoft.solverfoundation.common.rational(v=vs.93).aspx
F# has a BigNum type at Microsoft.FSharp.Math.BigNum
, you should be able to use it from C# as well.
This type exists in the F# Powerpack . Download it and reference the appropriate DLL (I suppose it's FSharp.Powerpack.Dll, but you'll need a little trial and error).
© 2022 - 2024 — McMap. All rights reserved.