2

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?

Community
  • 1
  • 1
George
  • 85
  • 1
  • 1
  • 7

3 Answers3

4

Use System.Numerics.BigInteger.

hmakholm left over Monica
  • 23,074
  • 3
  • 51
  • 73
  • I understand that .NET 3.5 doesn't support it by some reason.. so what should I do? – George Aug 25 '11 at 16:39
  • @George add that to your question and then see the responses on the question Adam Sills left in his comment – µBio Aug 25 '11 at 16:42
2

Would System.Numerics.BigInteger be appropriate?

http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx

JohnD
  • 14,327
  • 4
  • 40
  • 53
1

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."

illegal-immigrant
  • 8,089
  • 9
  • 51
  • 84