 Representing and manipulating data in computers

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

Free course

# 7.3 Subtracting 2's complement integers

You will probably have carried out subtraction of denary numbers using rules for subtraction that include the process of ‘borrowing’ whenever you need to subtract a larger digit from a smaller one. It is possible to perform binary subtraction in a very similar way, but that is not what happens in computers. The processor contains the circuits needed to perform addition, and it is much more efficient to use these circuits also to perform subtraction than it is to build in extra circuits to perform subtraction.

But how can subtraction be converted into addition? The answer is by first converting the number to be subtracted into its additive inverse. For example, the denary subtraction

7 − 5

can be converted into addition provided the additive inverse of 5 is used. As I mentioned in Section 3.4, the additive inverse of 5 is −5, and so the equivalent addition is

7 + (−5)

In 2's complement binary arithmetic, the additive inverse of a number is known as its 2's complement. I'll start, therefore, by showing you how to find the 2's complement of any binary number.