Now that we can represent signed numbers with 1's and 2's complement, let's see how they will help us convert our subtraction problems to addition. Consider the problem of subtracting 110 from 710. We can also think of this problem as adding -110 to 710. In order to do this, we will use the following steps:
- Convert 110 to -110 with either 1's or 2's complementation.
- Add -110 to 710.
- Adjust our answer.
You may be wondering why we need step three. The answer is that sometimes the sum in step two will exceed the number of bits in our representation. This is called overflow, and we handle the extra bit differently in 1's and 2's complement. In 1's complement, we add the overflow bit to our sum to obtain the final answer. In 2's complement, we simply discard the extra bit to obtain the final answer.
The links below illustrate how to solve our problem using 1's complement and 2's complement arithmetic. Click on one of the links below or use the navigation bar to work through both examples in order.
One's Complement | Two's Complement