# Binary division

Discussion in 'Math' started by asilvester635, Feb 15, 2017.

1. ### asilvester635 Thread Starter Member

Jan 26, 2017
68
3
One example is from a textbook. It performs a binary division, though I think they made a mistake in their calculations? Also, another one is a solution that I tried working out, but I also think they made a mistake. The answer that I think is wrong is highlighted in yellow. I worked out the subtraction by getting the 2's complementary. I'm pretty sure I did the 2's complementary right.

Binary division problem from the textbook

Another binary division problem and its solution

2. ### AlbertHall Distinguished Member

Jun 4, 2014
4,021
915
To get the 2's complement, you invert the digits and then add one.

3. ### asilvester635 Thread Starter Member

Jan 26, 2017
68
3
That is exactly what I did If you look at my work.

4. ### MrChips Moderator

Oct 2, 2009
14,240
4,174
In the first example, your analysis is correct.

In the second example, 1000 is not divisible by 1001. Hence the quotient is 0.

5. ### WBahn Moderator

Mar 31, 2012
20,057
5,644
It's easy enough to check if the results are correct or not. Do the math.

Assuming that both G and D (in the first image) are unsigned integers, then what values to G and D represent?

If you divide G by D what do you get for the integer quotient and the remainder?

Having said that, it looks like they are mixing up the notions of doing integer division and fixed-point division.

In the first image G = 9 and D = 46. 46 / 9 = 5 r 1

But are you sure that this is binary division and not polynomial division? There is a significant difference. The mere fact that they are using the terms 'G' and 'D' imply that this is polynomial division. That is also consistent with how they are adding the additional 0 bits (is the same as multiplying D by x^3 before dividing by G).

6. ### asilvester635 Thread Starter Member

Jan 26, 2017
68
3
Thank you for pointing that out. It is polynomial division. In that case we use XOR to do the subtraction. Thanks.