算法做算术运算上非常大的数字算术、非常大、算法、数字

2023-09-11 06:46:17 作者:国际逗比协会会长

我需要一个算法来对大量的(这是远高于浮动,双int或与此有关的任何其它数据类型的范围内)进行算术运算。我被要求写code在C我试图寻找在这里:克努特,唐纳德,计算机程序设计,ISBN 0-201-89684-2,第2卷的艺术:半数值算法,第4.3节。 1:经典算法的,但不能忍受。我只需要算法不是code。

I need a algorithm to perform arithmetic operations on large numbers(that are way above range of float, double int or any other data type for that matter). I am required to write the code in C. I tried looking up here: Knuth, Donald, The Art of Computer Programming, ISBN 0-201-89684-2, Volume 2: Seminumerical Algorithms, Section 4.3.1: The Classical Algorithms but couldn't stand it. I just need the algorithm not the code.

推荐答案

我觉得Karatsuba的算法是最好的大numbers.For足够大的n执行算术运算,另外一个泛化的Schönhage-Strassen的算法,甚至更快。 你可以查找算法 Karatsuba的 要么 Karatsuba_Multiplication

I think Karatsuba algorithm is best to perform arithmetic operations on large numbers.For sufficiently large n, another generalization, the Schönhage–Strassen algorithm, is even faster. You can look for the algorithm in Karatsuba or Karatsuba_Multiplication

 
精彩推荐
图片推荐