110110 ÷ 101 — binary arithmetic
corelong division with a remainder
Answer
001010 remainder 000100
Why this example is worth doing
Binary long division, where each step asks only whether the divisor fits — the quotient digit is 1 or 0 and never anything else. That makes the mechanics simpler than decimal division even though the working is longer. Fifty-four divided by five is ten remainder four, and the page prints the restoring-division trace that a hardware divider actually follows.
Try your own input in the Binary arithmetic. Add, subtract, multiply and divide in binary with every carry and borrow shown.
How the answer is reached
110110 / 000101 (6-bit unsigned)
| operand | bits | hex | unsigned | signed |
|---|---|---|---|---|
| A | 110110 | 0x36 | 54 | -10 |
| B | 000101 | 0x05 | 5 | 5 |
Restoring division: shift the remainder left, bring down the next bit, subtract the divisor. If the result is negative, restore it and emit quotient bit 0; otherwise keep it and emit 1.
| step | remainder after shift | trial subtract | restore? | quotient bit |
|---|---|---|---|---|
| 1 | 0000001 | 0000001 - 0000101 = -4 | yes | 0 |
| 2 | 0000011 | 0000011 - 0000101 = -2 | yes | 0 |
| 3 | 0000110 | 0000110 - 0000101 = 1 | no | 1 |
| 4 | 0000011 | 0000011 - 0000101 = -2 | yes | 0 |
| 5 | 0000111 | 0000111 - 0000101 = 2 | no | 1 |
| 6 | 0000100 | 0000100 - 0000101 = -1 | yes | 0 |
quotient001010 = 10
remainder000100 = 4
check10 x 5 + 4 = 54