Perform the 8-bit two's complement binary sum 17 - 24

The first step is to view the sum as an addition of a positive and a negative number, rather than a subtraction:
17 + (-24)
 
From there we can work out the binary equivalents of the 2 numbers:
     b7 b6 b6 b4 b3 b2 b1 b0
17   0  0  0  1  0  0  0  1
24   0  0  0  1  1  0  0  0
 
24 then has to be converted into it's equivalent negative number in two's complement. This is done in 2 steps:
1. Flip all the bits in the number
2. Peform binary addition of new number and 1.
 
So first we flip all the bits:
b7 b6 b6 b4 b3 b2 b1 b0
1  1  1  0  0  1  1  1
 
Then we add 1:
b7 b6 b6 b4 b3 b2 b1 b0
1  1  1  0  0  1  1  1
0  0  0  0  0  0  0  1
1  1  1  0  1  0   0   0
This gives us the two's complement representation of -24.
 
Then we simply perform the additon of 17 and -24 in binary:
b7 b6 b6 b4 b3 b2 b1 b0
0  0  0  1  0  0  0  1
1  1  1  0  1  0  0  0
1  1  1  1  1  0  0  1
 
Which, as expected, is the binary representation of -7 (you can check this by performing the same 2 stage method to convert the number back to positive 7, then back into decimal from there).

Related Electronics A Level answers

All answers ▸

Why a cable that transmit voltage increase its lengths?


Explain Ohm Law


Graph question Q1a in AQA 2016


Can you explain what bitmasking is, and how it works and what it's used for?


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo
Cookie Preferences