A register has no space for a minus sign, so the computer has to show negative numbers with bits alone. Two's complement does it by giving the leftmost bit a negative place value, and it lets the same adding circuits work for positive and negative numbers.
In 8-bit two's complement the most significant bit has the place value −128; the other bits are 64, 32, 16, 8, 4, 2, 1 as usual. So a number starting with 1 is negative and one starting with 0 is positive. The range is −128 to +127. To make a negative number, write the positive version in 8 bits, flip every bit, then add 1.
Fig. 1: in two's complement the leftmost bit is worth −128, so 11101100 is −20
Section 01
A negative place value.
In the lab, switch the bits on and off. Turning on the leftmost bit subtracts 128, so the number becomes negative.
Positive numbers look exactly the same as normal binary, with a 0 at the left: 00110001 = 49.
Negative numbers have a 1 at the left: add −128 to the other place values. 10000001 = −128 + 1 = −127.
Range: the smallest is 10000000 = −128; the largest is 01111111 = +127; 11111111 = −1.
Worked example Two's complement to denary
Convert the 8-bit two's complement integer 10110110 to denary.
The leftmost bit is 1, so start with −128.
The other 1s are under 32, 16, 4 and 2: 32 + 16 + 4 + 2 = 54.
−128 + 54 = −74.
Answer: −74
Examiner trap
Do not read the leftmost 1 as just a minus sign. 10000101 is −128 + 5 = −123, not −5.
Section 02
Flip and add one.
The lab's negate button shows the method in two steps. Use it on a few numbers, then try the examples by hand.
Worked example Denary to two's complement
Convert −45 to an 8-bit two's complement integer.
Write +45 in 8-bit binary: 00101101.
Flip every bit (0 to 1, 1 to 0): 11010010.
Add 1: 11010010 + 1 = 11010011.
Check: −128 + 64 + 16 + 2 + 1 = −45.
Answer: 11010011
Worked example Negative binary to denary, the other way
Find the denary value of 11111000 by flipping and adding 1.
Flip every bit: 00000111.
Add 1: 00001000 = 8.
The original started with 1, so it is negative.
Answer: −8
Your turn
Convert −100 to an 8-bit two's complement integer.