Two's Complement (Cambridge (CIE) IGCSE Computer Science): Revision Note
Two's Complement
What is two's complement?
Examiner Tips and Tricks
Cambridge IGCSE 0478 requires you to represent signed binary values using 8-bit two’s complement only. This page follows the exact bit structure and method examiners expect to see.
In IGCSE Computer Science, two's complement is a method of using signed binary values to represent negative numbers
Using two's complement the left most bit is designated the most significant bit (MSB)
To represent negative numbers this bit must equal 1, turning the column value in to a negative
Working with 8 bits, the 128 column becomes -128
-128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | = -1 |
In the example above to represent -1, add column values with a 1 to the MSB
MSB (-128)
Add 64 (-128+64 = -64
Add 32 (-64+32 = -32)
Add 16 (-32+16 = -16)
Add 8 (-16+8 = -8)
Add 4 (-8+4 = -4)
Add 2 (-4+2 = -2)
Add 1 (-2+1 = -1)
The two's complement representation of -1 is 11111111
Quick two's complement conversion
To represent -76
Write out the positive version of the number
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|
0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | = 76 |
Starting from the least significant bit (right most column), copy out the binary values up to and including the first 1
-128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
---|---|---|---|---|---|---|---|
1 | 0 | 0 |
For the remaining digits, invert them (0s to 1s/1s to 0s)
-128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
---|---|---|---|---|---|---|---|
1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
-128 + 32 + 16 + 4 = -76
The two's complement representation of -76 is 10110100
Examiner Tips and Tricks
The “flip and add 1” trick isn’t shown here, but the method above is what examiners prefer: copy from the right, then invert. It’s reliable, repeatable, and rewarded in papers.
You've read 1 of your 5 free revision notes this week
Unlock more, it's free!
Did this page help you?