Number Systems
Data Representation · 4 question types
Exam Frequency Analysis
Past paper frequency (2018 to 2024)
This topic accounts for approximately 12% of your exam marks.
Binary/hex conversion and binary arithmetic appear in every Paper 1. Consistently 8 to 15 marks.
So far every binary number has been unsigned, meaning all the bits represent positive values. To store negative numbers, the syllabus uses , an 8-bit format where the leftmost bit's place value is negative.
The key idea
In an 8-bit two's complement value, the column headings are:
| −128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
Notice the leftmost column is −128, not +128. The other columns keep their normal positive values. The leftmost bit is therefore the sign bit: if it is 0, the number is positive (or zero); if it is 1, the number is negative.
The range of 8-bit two's complement
| Bit pattern | Denary value |
|---|---|
| 00000000 | 0 |
| 01111111 | +127 (the largest positive value) |
| 10000000 | −128 (the smallest negative value) |
| 11111111 | −1 |
So the range is −128 to +127 inclusive.
Reading a two's complement number
To find the denary value of a two's complement number, sum every column heading whose bit is set to 1, treating the leftmost column as −128.
Writing a negative number in two's complement
The fastest method on paper is the copy-and-invert trick:
- Write the positive equivalent of the number in 8-bit binary.
- Working from the right-hand end, copy each bit unchanged until you have written down the first 1 you meet (the 1 itself is also copied).
- Invert every bit to the left of that 1 (turn 0s into 1s and 1s into 0s).
Alternative method: invert all bits and add 1
A second standard method gives the same answer:
- Write the positive equivalent in 8-bit binary.
- Invert every bit (flip 0 ↔ 1). This gives the one's complement.
- Add 1 to the result. The final 8-bit value is the two's complement.
Both methods are accepted in the exam; pick whichever you find easier and stick with it.
Why two's complement is used
Two's complement is the dominant way of storing signed integers in modern computers because:
- One representation for zero. Some other schemes (like sign-and-magnitude) have both a +0 and a −0, wasting a bit pattern. Two's complement has only one 0.
- Addition works the same for positive and negative numbers. The CPU can use one binary adder for both signed and unsigned arithmetic; no special "subtract" hardware is needed.
- Negative numbers behave naturally. Adding a number and its negative gives 0 (with the carry-out discarded), exactly as expected.
Converting a negative denary number to two's complement
Express −114 as an 8-bit two's complement integer.
Solution:
- Write the positive equivalent in 8-bit binary: 114 = 64 + 32 + 16 + 2 = 01110010
- Invert every bit (one's complement): 10001101
- Add 1 to the one's complement: 10001101 + 1 = 10001110
- Result: 10001110 (which represents −114 in 8-bit two's complement)
Check: −128 + 8 + 4 + 2 = −114 ✓