Addition of Binary Numbers
Addition of Binary Numbers (Adding Two Positive 8-bit Numbers)#
Binary Addition Rules#
| Bit 1 | Bit 2 | Carry Happens? (Carry Out = 1) | Sum |
|---|
| 0 | 0 | ❌ No | 0 |
| 0 | 1 | ❌ No | 1 |
| 1 | 0 | ❌ No | 1 |
| 1 | 1 | ✅ Yes (Carry Out = 1) | 0 |
What is a Carry?#
When adding bits, if the total is 2 (which is '10' in binary), write 0 and carry 1 to the next left bit.
If total is 3 ('11' in binary), write 1 and carry 1.
Binary Addition examples:#
a) Add 45 + 100 (8-bit)#
Step 1: Convert to 8-bit binary| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| Number 2 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
| Carry In | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 |
| Sum | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
Result:
Sum (8-bit): 01011011 (91 in decimal)b) Add 12 + 34 (8-bit)#
Step 1: Convert to 8-bit binary| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
| Number 2 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| Carry In | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
| Sum | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 |
Result:
Sum (8-bit): 00101110 (46 in decimal)
c) Add 78 + 57 (8-bit)#
Step 1: Convert to 8-bit binary| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 |
| Number 2 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| Carry In | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| Sum | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
Result:
Sum (8-bit): 10000111 (135 in decimal)
d) Add 150 + 50 (8-bit)#
Step 1: Convert to 8-bit binary| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 |
| Number 2 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| Carry In | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
| Sum | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
Result:
Sum (8-bit): 11001000 (200 in decimal)
Some examples with Overflow#
If the sum requires more bits than available (e.g., result is 9 bits but only 8 bits allowed), the extra bit is called overflow.
Overflow means the result can’t fit in the assigned number of bits.
Working Example:#
a) Add 01101110(110) + 11011110(222)#
| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
| Number 2 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 |
| Carry In | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |
| Sum | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 |
8-bit Truncated: 00101100 = 44 (due to overflow)
Key Point: The 9th carry bit was discarded, causing overflow (332 > 255). The 8-bit result is incorrect.b) Add 89 + 175 (8-bit)#
Step 1: Convert to 8-bit binary| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| Number 2 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |
| Carry In | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |
| Sum | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
Result:
Short Answer:
Sum (8-bit): 00001000 (8 in decimal)
Overflow: Yes (carry out from MSB) → True sum (264) exceeds 8-bit range (0-255).Explanation:#
89 + 175 = 264, but 8-bit max is 255.
Binary addition yields 00001000 (8) with a carry out, indicating overflow.
Correct result requires 9 bits: 100001000 (264).
c) Add 168 + 99 (8-bit)#
Here's the improved version with the explanation integrated:Step 1: Convert to 8-bit binary| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| Number 2 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |
| Carry In | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
| Sum | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
Result:
8-bit Result: 00001000 = 8 (decimal) ❌
(This is obtained by taking only the rightmost 8 bits of the sum and discarding the 9th overflow bit)Actual sum in decimal: 89 + 175 = 264 → exceeds 255 → unsigned overflow occurs.
(The correct 9-bit result is 100001000, but 8-bit systems can only store 00001000)
d) Add 88 + 215 (8-bit)#
Step 1: Convert to 8-bit binaryStep 2: Add bit by bit with carries| Bit Position | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
| Number 2 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 |
| Carry | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| Sum | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 |
Result:
8-bit Result: 00110111 = 55 (decimal) ❌
(Only the rightmost 8 bits are kept, discarding the overflow carry)Actual sum in decimal: 88 + 215 = 303 → exceeds 255 → unsigned overflow occurs.
(Full 9-bit result would be 100110111, but 8-bit truncation gives incorrect 00110111)Key Observation:
The 9th carry bit (1) indicates overflow, making the 8-bit result invalid.
16-bit Addition Practice Solutions#
a) Add#
0111 1111 1111 0001 + 0101 1111 0011 1001| Bit Position | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
| Number 2 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| Carry In | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| Sum | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
Result:
16-bit Result: 1101 1111 0010 1010 (0xDF2A) = 57,130 ✅
Actual sum: 32,753 + 24,377 = 57,130 → No overflow (≤65,535)Note: All carries propagate correctly without final overflow (no 17th bit generated). The result matches manual calculation:0x7FF1 (32,753) + 0x5F39 (24,377) = 0xDF2A (57,130)
b) Add#
1110 1110 0000 1011 + 1111 1101 1101 1001| Bit Position | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|---|
| Number 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
| Number 2 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 |
| Carry In | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
| Sum | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Result:
16-bit Result: 1110 1100 0000 0000 (0xEC00)
Actual sum in decimal: 60,939 + 64,985 = 125,924
Overflow: ❌ (Result requires 17 bits, but only 16 are available)1.
Full 17-bit result would be 1 1110 1100 0000 0000 (121,344)
2.
16-bit truncation gives 1110 1100 0000 0000 (60,416)
3.
Correct sum (125,924) > 65,535 → Overflow occurs
Key Observation:
The discarded 17th carry bit (1) indicates overflow, making the 16-bit result invalid. The truncated value (60,416) is incorrect due to overflow.Modified at 2025-08-12 06:15:32