Representing and manipulating data in computers
Representing and manipulating data in computers

This free course is available to start right now. Review the full course description and key learning outcomes and create an account and enrol if you want a free statement of participation.

Free course

Representing and manipulating data in computers

7.3.2 Subtraction

As I indicated at the start of this section, subtraction is converted to addition by replacing the number to be subtracted by its additive inverse, which in the case of binary arithmetic is its 2's complement. An example should make this clear.

Example 9

Subtract the signed integer 1010 1010 from the signed integer 0001 0110.

Answer

The additive inverse of the number to be subtracted, 1010 1010, is 0101 0101 + 1 = 0101 0110. Using this additive inverse transforms the computation to an addition:

(Check: 1010 1010 is −86 and 0001 0110 is 22, so the calculation is 22 − (−86), which is 108, and 0110 1100 is indeed 108.)

Activity 25 (Self assessment)

Carry out the following subtraction by first finding the additive inverse of the number to be subtracted:

1100 1010 − 0000 1110

Answer

The additive inverse of the integer to be subtracted is its complement plus 1:

1111 0001 + 0000 0001

which is 1111 0010.

So the calculation is now:

The ninth bit can be ignored here, as mentioned in Section 7.2. So the result is 1011 1100.

T224_2

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has nearly 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to university level study, find out more about the types of qualifications we offer, including our entry level Access courses and Certificates.

Not ready for University study then browse over 900 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus