β Adders: how a computer adds
1 + 1 = 10β
Half adder
Adds two bits. Sum = A XOR B, Carry = A AND B. 1 + 1 = 10 in binary: sum 0, carry 1.
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
- Binary has only two digits: 0 and 1. Rules: 0+0 = 0, 0+1 = 1, 1+1 = 10 (write 0, carry 1), 1+1+1 = 11.
- Exactly like decimal column addition, where 7 + 5 = 12 means βwrite 2, carry 1β.
- Subtraction uses the same adder: add the twoβs complement (flip every bit with XOR, add 1 with the carry-in).