Unsigned Binary to Negative Binary Conversion
Two's complement is the method computers use to store negative whole numbers in binary. To turn a negative denary number into its 8-bit two's complement pattern, start from the positive version of the number and follow three steps: write the positive value in 8 bits, flip every bit, then add 1.
The flip on its own gives a pattern that is one less than the value you need: the flipped 9 is 11110110, which is -10, not -9, so the add-one step must come after the flip, never before. A quick check on your answer: a negative number always starts with a 1 in the leftmost bit, while a positive number starts with 0. You only use these steps for negative values, because a positive number's pattern is already correct as it stands.
| Step | 8-bit pattern |
|---|---|
| Positive 9 in binary | 00001001 |
| Flip every bit | 11110110 |
| Add 1 | 11110111 |
So -9 is stored as 11110111. A second run-through: positive 20 is 00010100, which flips to 11101011, and adding 1 gives 11101100 for -20.
Edexcel GCSE Computer Science · Unsigned Binary to Negative Binary Conversion