In an earlier article, we learned about 2’s complement addition. In this article, we will discuss how to perform 1’s complement addition. We will consider the same example that is taken for the 2’s complement addition.
Important Rule: Add the two numbers using the basic rules of binary addition. If there is a carry out of the MSB, then discard the carry, and add ‘1’ to the result. |
We have considered 8-bit signed binary numbers (1 bit for sign and 7 bits for magnitude) for our example. The addend, augend, and the Sum are represented in 1’s complement form.
Both the numbers are positive
Example: 8 + 5 = ?
1’s complement representation of 8 = 00001000
1’s complement representation of 5 = 00000101
Since 8 and 5 are positive, so their 1’complement representation will be the same as its true (uncomplemented) form.
The resultant sum is a positive number.
Negative number with smaller magnitude than the positive number
Example: 8 + (-5) = ?
This example can also be read as a subtraction problem, that is 8 – 5 = ?
1’s complement representation of 8 = 00001000
1’s complement representation of -5 = 11111010
The resultant sum is a positive number.
Negative number with larger magnitude than the positive number
Example: -8 + 5 = ?
1’s complement representation of -8 = 11110111
1’s complement representation of 5 = 00000101
The resultant sum is a negative number.
Both the numbers are negative
Example: -8 + (-5) = ?
1’s complement representation of -8 = 11110111
1’s complement representation of -5 = 11111010
The resultant sum is a negative number.
The examples taken in this article are carefully chosen so that the overflow condition does not arise. Overflow occurs if the carries into and out of MSB are different. Overflow, in the case of signed binary arithmetic, is an unwanted condition, as it results in an incorrect sum. Thus, it is important to learn about Overflow and how to avoid it.