T
T
tendkuh2019-07-17 07:49:02
Algorithms
tendkuh, 2019-07-17 07:49:02

How to perform a division operation using a single addition?

An adder works in the processor, and judging by its name, it seems to only know how to add binary numbers.
Describe the operation of division, point by point, it is not at all clear how this is possible in nature, so that a number is divided by addition, this super-magic is done somehow with the help of a negative number, is it somewhere along the path of the algorithm?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Developer, 2019-07-17
@tendkuh

https://en.wikipedia.org/wiki/Division_algorithm
phg.su/basis2/X154.HTM

A
Alexander, 2019-07-17
@NeiroNx

It is very simple to repeat the addition operation until there is nothing left of the number:

int num=100;
int del=3;
int result = 0;
while(num >= del) {
num -= del;
result++;
}

num - remainder of division - 1
result - result of division - 99

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question