Binary numbers
Binary addition and overflow
Goal: Add binary numbers column by column · 9 min
Binary addition works like written addition in decimal, with only four rules:
| result | carry | |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 (with carry) | 1 | 1 |
0110 (6) + 0111 (7) = 1101 (13)
A computer works with a fixed number of bits. If the result needs more bits than are available, the top carry is lost: overflow. In 4 bits, 1100 + 0101 = 1 0001 → only 0001 is kept: 12 + 5 "=" 1.
Worked example: 1011 + 0011
- Rightmost: 1 + 1 = 0, carry 1.
- Next: 1 + 1 + 1 = 1, carry 1; then 0 + 0 + 1 = 1; then 1 + 0 = 1.
- Result 1110 = 14 (11 + 3 ✓).