Data Representation · 4 question types
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, Cambridge IGCSE uses two's complement, an 8-bit format where the leftmost bit's place value is negative.
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.
| 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.
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.
Example — What denary value does 11111111 represent?
−128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = −1
Example — What denary value does 10110100 represent?
−128 + 32 + 16 + 4 = −76
The fastest method on paper is the copy-and-invert trick:
Example — Represent −76 in 8-bit two's complement.
Positive 76 in 8-bit binary:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
Apply the copy-and-invert trick: working right to left, copy 100 (the two trailing zeros and the first 1). Then invert all the bits to the left of that first 1:
| −128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
Sanity check: −128 + 32 + 16 + 4 = −76. ✓
A second standard method gives the same answer:
Both methods are accepted in the exam; pick whichever you find easier and stick with it.
Two's complement is the dominant way of storing signed integers in modern computers because: