# Mul + div using only add/sub ? [closed]

In an algorithm book once the first example was how to compute a multiplication in a loop (only that, so I just remembered, and wanted to do it programmatically but with all operations)

Multiplication was simple, say 10 * 4:

base = 0, x = 10, y = 4:

While y != 0:
base + x = 10, y--
base + x = 20, y--
base + x = 30, y--
base + x = 40, y-- (y is now 0)

Result of base: 40 (correct)


As the opposite of taking away is giving, I assumed the same was for division and multiplication (doubling, halving), but: "base - x.." clearly does not give anything useful in an iteration..

Is this impossible? Am I looking at an algorithm to divide completely the wrong way (not like my mult)?

-

## closed as off topic by Andrea Ferretti, Victor Protsak, José Figueroa-O'Farrill, Harald Hanche-Olsen, François G. Dorais♦Sep 12 '10 at 21:48

Questions on MathOverflow are expected to relate to research level mathematics within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Take away x until you would go below zero. The number of times you took x away is the quotient. The number left is the remainder. Is this what you are looking for? Or do you want a decimal expansion of the fraction you get? By the way, you cannot multiply fractions using your algorithm - what is 1/2 times 1/3? Add 1/3 to itself repeatedly 1/2 a time? A computer would no take that instruction. – Steven Gubkin Sep 12 '10 at 20:09