how to represent large numbers in C# [duplicate]
Possible Duplicate:
What should I use for a BigInt class in .NET?
I need to represent large numbers in C#.
I tried Int64
, but now I need to deal with 68! (factorial(68)).
I checked UInt64
and it also isn't good enough.
people here say to use BigInteger, but I understand that .NET 3.5 doesn't support it by some reason.. so what should I do?
Use System.Numerics.BigInteger.
Would System.Numerics.BigInteger
be appropriate?
http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx
BigInteger
can hold almost any integer value.But you should remember the following :
"Because the BigInteger type is immutable (see Mutability and the BigInteger Structure) and because it has no upper or lower bounds, an OutOfMemoryException can be thrown for any operation that causes a BigInteger value to grow too large."
精彩评论