Table of Contents
Last modified on October 30th, 2023
Binary addition involves the addition of two binary numbers, 0 and 1. Each digit is called a bit.
The addition in binary is similar to decimal addition involving 2 numbers. It follows 4 rules:
We can summarize it as:
A + B | Sum | Carry |
0 + 0 | 0 | 0 |
0 + 1 | 1 | 0 |
1 + 0 | 1 | 0 |
1 + 1 | 0 | 1 |
The result of binary addition is the same as we obtain from decimal addition, with the difference in the place values of the digits.
Regrouping is done when the sum of 2 or more binary digits is greater than 1.
Let us add the binary numbers 11012 and 1012. Here, we show the overflow of the process.
Step 1: Aligning the numbers based on their place values
Step 2: Adding the digits in ones place using the binary addition rules.
1 + 1 = 10
Thus,
Step 3: Moving on to the next column.
1 + 0 + 0 = 1
Step 4: In the 3rd column
1 + 1 + 10, so carry 1
Step 5: Finally,
1 + 1 = 10
Thus, 11012 + 1012 = 0100102
When the 2 binary numbers being added are 0 and 1, regrouping is unnecessary.
Let us add the binary numbers 1012 and 102
Step 1: Aligning the numbers based on their place values
Step 2: Adding the digits in ones place using the binary addition rules.
1 + 0 = 1
Step 3: Moving on to the second column.
Similarly, 0 + 1 = 1
Here, also there is no carry
Step 4: Finally, in the last column
1 + 0 = 1
Thus, 1012 + 102 = 01112
There are 2 types of complement of a binary number: 1’s complement and 2’ complement. In 1’s complement, we add two negative binary numbers, while 2’s complement of a binary number is always 1, added to the 1’s complement of the binary number.
There are 2 possible situations:
Case 1: When the Positive Number is Greater in Magnitude
Here, we take the 1’s complement of the negative number, and the carried number is added to the sum of the numbers at the 1’s place. To find the 1’s complement of a number, we alter every 0 by 1 and every 1 by 0.
For example, 1’s complement of the binary number 100 is 011.
Let us add the numbers: 10102 + (-11012)
Rewriting, we get:
11102 – 11012
+ 11102 → 011102
-11012 → 100102 (Taking 1’ complement)
Thus, the required sum is + 0001.
Case 2: When the Negative Number is Greater in Magnitude
In this case, we take the 1’s complement of the negative number, and there is no end-around carrying. Finally, the result is obtained by taking the 1’s complement of the sum.
The result will always be a negative number.
Let us add the numbers: 01112 + (-1000)2
1’s complement of -1000 → 01112
Now, adding the 1’s complement to 01112
Finally, by taking the 1’s complement of the sum, we get
1 1 1 0 → 0 0 0 1
Here, we will add a negative sign before the number (as the negative number was greater) to get the final result.
0 0 0 1 → – 0 0 0 1
Here, we find the 1’s complement of both the negative numbers and then add both the complement numbers. Here, we will get the end-around carry to get the final result.
Let us add the numbers: -10102 +(- 00112)
Taking 1’s complement of both the numbers
10102 → 101012
00112 → 111002
Taking the 1’s complement of 100102 to get the result100102 → 111012
Last modified on October 30th, 2023