我需要在C#中表示大数字。
我试过Int64
,但现在我需要处理68! (阶乘(68))。
我检查了UInt64
,但这还不够好。
这里的人说要使用BigInteger,但我知道.NET 3.5不支持它。所以我该怎么办?
答案 0 :(得分:4)
答案 1 :(得分:2)
System.Numerics.BigInteger
会合适吗?
http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx
答案 2 :(得分:1)
BigInteger
几乎可以保存任何整数值。但是你应该记住以下内容:
“因为BigInteger类型是不可变的(参见Mutability和 BigInteger Structure)因为它没有上限或下限,所以 对于导致a的任何操作,都可以抛出OutOfMemoryException BigInteger值增长过大。“