我需要写一个算法(不能使用任何第三者库,因为这是一个赋值)来划分(整数除法,浮点数并不重要)非常大的数字,例如100-1000位数字。我找到了http://en.wikipedia.org/wiki/Fourier_division算法,但我不知道这是否是正确的方法。你有什么建议吗?
1) check divisior < dividend, otherwise it's zero (because it will be an int division) 2) start from the left 3) get equal portion of digits from the dividend 4) if it's divisor portion is still bigger, increment digits of dividend portion by 1 5) multiply divisor by 1-9 through the loop 6) when it exceeds the dividend portion, previous multiplier is the answer 7) repeat steps 3 to 5 until reaching to the end
Knuth,Donald,计算机编程艺术,ISBN 0-201-89684-2,第2卷:半数值算法,第4.3.1节:经典算法