我需要编写一个算法(不能使用任何第三方库,因为这是一项任务),来除以非常大的数字,例如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