大整数在C# [英] Big integers in C#
问题描述
目前我借款 java.math.BigInteger中的
从这里描述的J#库。从未使用过一个库之前,大整数工作,这似乎慢,慢10倍的数量级,甚至对 ULONG
长度的数字。没有人有任何更好的(preferably免费)库,或者是这个级别的性能是否正常?
Currently I am borrowing java.math.BigInteger
from the J# libraries as described here. Having never used a library for working with large integers before, this seems slow, on the order of 10 times slower, even for ulong
length numbers. Does anyone have any better (preferably free) libraries, or is this level of performance normal?
推荐答案
随着.NET 4.0,你可以使用System.Numerics.BigInteger类。在这里看到的文档:<一href=\"http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx\">http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx
As of .NET 4.0 you can use the System.Numerics.BigInteger class. See documentation here: http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx
另一种方法是 INTX 类。
INTX是任意precision
整数库写在纯C#
2.0快速 - O(N *日志N) - 乘法/除法算法
实现。它提供了所有
像整数基本操作
加法,乘法,比较
按位移动等。
IntX is an arbitrary precision integers library written in pure C# 2.0 with fast - O(N * log N) - multiplication/division algorithms implementation. It provides all the basic operations on integers like addition, multiplication, comparing, bitwise shifting etc.
这篇关于大整数在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!