Chapter 8

Division

Long division in school was mostly about guessing — "does 7 go into 23 how many times?" takes trial and error. Binary division skips the guessing entirely, because a divisor can only ever fit zero or one times at each step. That "guess" is just the comparison you learned in Chapter 5.

Bring down, compare, subtract, repeat

Binary long division works exactly like the decimal version you already know, one bit at a time:

Dividend bit Divisor Remainder Quotient (output)
1. Bring down the next bit of the dividend, and stick it onto the end of whatever remainder you've got so far.
2. Compare: is that value ≥ the divisor?
3. If yes — subtract the divisor, and write down a quotient bit of 1.
4. If no — leave it alone, and write down a quotient bit of 0.
5. Repeat for every remaining bit. Whatever's left at the end is the remainder.

Every "subtract" in step 3 is the two's-complement trick from Chapter 5, and every "compare" is really just attempting that subtraction and checking whether the result would have gone negative. There is no dedicated division circuit either — it's subtraction, wearing a trench coat.

Try it: Dividend ÷ Divisor

Interactive — Long Division in Binary
Dividend
= 0
Divisor
= 0
Dividend Divisor Remainder Quotient (output)
 

That's all four operations. Add, subtract, multiply, divide — every one of them boils down to the same handful of switches, wired into gates, wired into adders, run over and over. Next: see how a real computer scales this exact same trick up to billions of switches.