Binary addition is straight forward – all we need to do is follow these simple rules:
0 + 0 = 0
1 + 0 = 1
0 + 1 = 1
1 + 1 = 10
1 + 1 + 1 = 11
Binary addition is often done in multiple columns and we always start with the column on the right and move to the next column on the left.
EG – add binary numbers 10 + 01
1 | 0 | |
+ | 0 | 1 |
= | 1 | 1 |
Explanation | (1 + 0 = 1) | (0 + 1 = 1) |
10 + 01 = 11
Binary 1 + 1
If we get a 1 + 1 our rules state we get 10. We should carry the 1 over to the column on the left and include this when adding up the next column. The 0 will stay in the current column.
EG – add binary numbers 01 + 01
0 | 1 | |
+ | 0 | 1 |
= | 1 | 0 |
Carry | 1 | |
Explanation | (0 + 0 + 1 = 1 the 1 is our carry from the column on the right) | (1 + 1 = 10 the 1 is carried to the next column and the 0 is placed in the current column) |
01 + 01 = 10
Binary 1 + 1 (in the left column)
If we get a 1 + 1 in our furthest left column we simply add another digit on.
EG – add binary numbers 11 + 01
1 | 1 | ||
+ | 0 | 1 | |
= | 1 | 0 | 0 |
Carry | 1 | 1 | |
Explanation | (1 + 0 + 1 = 10 the 1 is carried to the next column and the 0 is placed in the current column) | (1 + 1 = 10 the 1 is carried to the next column and the 0 is placed in the current column) |
11 + 01 = 100
Binary 1 + 1 + 1
If we get a 1 + 1 + 1 (because of a carry) our rules state we get 11. We should carry the 1 over to the column on the left and include this when adding up the next column. The 1 will stay in the current column.
EG – add binary numbers 11 + 11
1 | 1 | ||
+ | 1 | 1 | |
= | 1 | 1 | 0 |
Carry | 1 | 1 | |
Explanation | (1 + 1 + 1 = 11 the 1 is carried to the next column and the 1 is placed in the current column) | (1 + 1 = 10 the 1 is carried to the next column and the 0 is placed in the current column) |
11 + 11 = 110
Binary addition to 8 digits
The OCR Computer Science GCSE specification expects you to be able to add 8 bits of binary together EG
1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | |
+ | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
= | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
Carry | 1 | 1 | 1 | 1 | 1 |
Binary Overflow
If a binary addition creates an extra digit like in some of the examples above it can cause an overflow error in the processor. An 8-bit processor cannot handle 9 bits and will only receive the first 8 bits leading to unexpected results.
A famous example of an overflow error is the Ariane 5 space rocket launch which went wrong due to an overflow error (luckily it was an unmanned space rocket and no one was hurt!).