Intro
This is a continuation of the learning binary series. Be sure to read learning binary before reading this post.Binary addition
Lets start with basic decimal addition.
The basic values column
1000 | 100 | 10 | 1
Example
1 | 1 | ||||
1 | 5 | 9 | 5 | ||
+ | 3 | 5 | 6 | 4 | |
_ | _ | _ | _ | ||
5 | 1 | 5 | 9 |
We take the first digit and carry that. While the second digit remains below.
The digit you carried is added to the number.
5 + 4 = 9 > 9 Is less then 10 so we don't carry over.
9 + 5 = 15 > 15 is higher then 10. We need to carry a 1 over into the 100's column.
1 + 5 + 5 = 11 > 11 is higher then 10. We need to carry a 1 over into the 1000's column.
1 + 1 + 3 = 5 > 5 is less then 10 so we don't carry over.
Onto binary addition
Binary addition is the same concept. Except for your using binary numbers 1 and 0. Answer 5159
The five basic addition rules
0 + 0 = 01 + 0 = 1
10 + 0 = 10
1 + 1 = 10 > 1 + 1 = 2 > 10 = 2 in binary
10 + 1 = 11
Example:
1 | 1 | 1 | ||||
1 | 0 | 1 | 1 | |||
+ | 1 | 0 | 1 | 1 | ||
_ | _ | _ | _ | _ | ||
1 | 0 | 1 | 1 | 0 |
1 + 1 = 10 > We carry the 1
1 + 1 + 1 = 10 + 1 = 11 > We carry the 1
1 + 0 = 1
1 + 1 = 10 > Since there is no more columns to carry. We put 10.
You can double check
1011 = 11
1011 = 11
11 + 11 = 22
Answer 10110 = 22