如何在。net中表示一个非常大的整数?

时间:2022-04-11 18:36:02

Does .NET come with a class capable of representing extremely large integers, such as 100 factorial? If not, what are some good third party libraries to accomplish this?

.NET是否具有能够表示极大整数(如100 !)的类?如果没有,有哪些好的第三方库可以实现这一点?

5 个解决方案

#1


17  

.NET 4 has a BigInteger class

.NET 4有一个BigInteger类

Represents an arbitrarily large signed integer.

表示任意大的有符号整数。

The BigInteger type is an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds. This type differs from the other integral types in the .NET Framework, which have a range indicated by their MinValue and MaxValue properties.

BigInteger类型是不可变类型,它表示一个任意大的整数,其值在理论上没有上限或下限。这种类型不同于。net框架中的其他整数类型,它们的MinValue和MaxValue属性表示范围。

#2


13  

.NET has a BigInteger class, but it is internal, unfortunately. However, several places have their own. You can grab an implementation from IronPython, or the one from CodeProject, or from Visual J#. I have to say, I've not tried these myself, so I don't know which one is the best.

. net有一个BigInteger类,但不幸的是它是内部的。然而,有些地方也有自己的特色。您可以从IronPython、CodeProject或Visual J#获取实现。我不得不说,我自己还没有尝试过这些,所以我不知道哪一个是最好的。

http://www.codeplex.com/IronPython http://www.codeproject.com/KB/cs/biginteger.aspx http://msdn.microsoft.com/en-us/magazine/cc163696.aspx

http://www.codeplex.com/IronPython http://www.codeproject.com/KB/cs/biginteger.aspx http://msdn.microsoft.com/en-us/magazine/cc163696.aspx

#3


11  

Microsoft.FSharp.Math.Types.BigInt

Microsoft.FSharp.Math.Types.BigInt

It can represent any integer.

它可以表示任何整数。

#4


5  

Here is a link the documentation of big integer in framework 4.0

下面是framework 4.0中的大整数文档链接

http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(VS.100).aspx

http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(VS.100). aspx

#5


4  

Mono has a public BigInteger implementation already:

Mono已经有一个公共BigInteger实现:

http://www.go-mono.com/docs/index.aspx?link=T:Mono.Math.BigInteger

http://www.go-mono.com/docs/index.aspx?link=T Mono.Math.BigInteger

You can just grab the Mono.Security assembly to use it; since its a Mono class library it should be MIT licensed too.

你可以拿着单声道。使用该程序的安全程序集;由于它是一个Mono类库,它也应该得到MIT的许可。

#1


17  

.NET 4 has a BigInteger class

.NET 4有一个BigInteger类

Represents an arbitrarily large signed integer.

表示任意大的有符号整数。

The BigInteger type is an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds. This type differs from the other integral types in the .NET Framework, which have a range indicated by their MinValue and MaxValue properties.

BigInteger类型是不可变类型,它表示一个任意大的整数,其值在理论上没有上限或下限。这种类型不同于。net框架中的其他整数类型,它们的MinValue和MaxValue属性表示范围。

#2


13  

.NET has a BigInteger class, but it is internal, unfortunately. However, several places have their own. You can grab an implementation from IronPython, or the one from CodeProject, or from Visual J#. I have to say, I've not tried these myself, so I don't know which one is the best.

. net有一个BigInteger类,但不幸的是它是内部的。然而,有些地方也有自己的特色。您可以从IronPython、CodeProject或Visual J#获取实现。我不得不说,我自己还没有尝试过这些,所以我不知道哪一个是最好的。

http://www.codeplex.com/IronPython http://www.codeproject.com/KB/cs/biginteger.aspx http://msdn.microsoft.com/en-us/magazine/cc163696.aspx

http://www.codeplex.com/IronPython http://www.codeproject.com/KB/cs/biginteger.aspx http://msdn.microsoft.com/en-us/magazine/cc163696.aspx

#3


11  

Microsoft.FSharp.Math.Types.BigInt

Microsoft.FSharp.Math.Types.BigInt

It can represent any integer.

它可以表示任何整数。

#4


5  

Here is a link the documentation of big integer in framework 4.0

下面是framework 4.0中的大整数文档链接

http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(VS.100).aspx

http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(VS.100). aspx

#5


4  

Mono has a public BigInteger implementation already:

Mono已经有一个公共BigInteger实现:

http://www.go-mono.com/docs/index.aspx?link=T:Mono.Math.BigInteger

http://www.go-mono.com/docs/index.aspx?link=T Mono.Math.BigInteger

You can just grab the Mono.Security assembly to use it; since its a Mono class library it should be MIT licensed too.

你可以拿着单声道。使用该程序的安全程序集;由于它是一个Mono类库,它也应该得到MIT的许可。