开发者

how to represent large numbers in C# [duplicate]

This question already has answers here: Closed 11 years ag开发者_StackOverflow社区o.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜