Hi and I am making a maths library which will accept infinit digits but what is the best formula a computer can understand for devision. The only one I have come across so far is long devision but is there anything better? The following is the kinda formula I am thinking of doing...

``````input1=8
input2=3
amount=0
while (amount<=(input1-input2)) {
amount = amount + input2
}
remainder = input1-amount

//------ results
remainder
//------``````

Now that I have the floor(answer) and the remainder, how do I work out the 0.666666666 which ((1/input2)*remainder) will give. Of course I am making a division algorithm so I can't use division or multiplication to get the answer. I can only use addition and subtraction. I think long devision is a slow answer but is there anything faster. By faster I mean less use of addition and subtraction but only use of addition and subtraction. Any ideas explained clearly??

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by cwarn23

First the numbers you can accept is limited to the bytes of memory the
computer has. For an algorithm for division of large numbers, google
newton raphson method.

There are many algorithms for division. Among them: