Signed number representation (1's complement)
1. Why Signed Representation is Needed
A binary pattern has no inherent sign — 1111 0110 means 246 as an unsigned number. To handle negative values, three schemes were developed:
| Scheme | Idea | Status |
|---|---|---|
| Sign-magnitude | MSB = sign, rest = magnitude | Simple, obsolete (two zeros) |
| 1's complement | Negative = bitwise inversion of the positive | Historic (needs end-around carry) |
| 2's complement | Negative = inversion + 1 | Universal in modern CPUs |
In all three, the MSB acts as the sign bit — 0 means positive, 1 means negative.
2. The Problem with Sign-Magnitude (for comparison)
, in 8 bits. Range for bits is
(8 bits → −127 to +127). Drawbacks: two representations of zero (+0 = 0000 0000, −0 = 1000 0000) and addition/subtraction need extra logic to compare magnitudes and signs.
3. 1's Complement — Definition
The 1's complement of a binary number is obtained by inverting every bit (each 0 → 1, each 1 → 0). For an -bit negative number:
So 1's complement is the bitwise NOT of the magnitude in exactly bits.
| Decimal | Magnitude (8-bit) | 1's complement (negative form) |
|---|---|---|
| +9 | 0000 1001 | — |
| −9 | 0000 1001 → invert | 1111 0110 |
| +45 | 0010 1101 | — |
| −45 | invert | 1101 0010 |
| +0 | 0000 0000 | — |
| −0 | invert | 1111 1111 |
4. Range and the Dual-Zero Problem
Same as sign-magnitude: to , i.e. −127…+127 for 8 bits.
Both +0 (0000 0000) and −0 (1111 1111) exist, so only distinct values are representable out of patterns.
5. Arithmetic with 1's Complement — Addition
Add the two 8-bit patterns as ordinary binary, and then handle the carry out of the MSB by end-around carry: if a carry is generated, add it back to the LSB (wrap around).
Example 1: 9 + (−4)
0000 1001 (+9)
+ 1111 1011 (−4 in 1's complement)
───────────
1 0000 0100 carry out → add it back to the LSB
0000 0100
+ 0000 0001
───────────
0000 0101 = +5 ✓
Example 2: (−5) + 2
1111 1010 (−5)
+ 0000 0010 (+2)
───────────
1111 1100 no carry out → result is negative;
magnitude = 1's complement of 1111 1100 = 0000 0011 = 3 → answer −3 ✓
Example 3: (−5) + (−2)
1111 1010 + 1111 1101 = 1 1111 0111 → end-around carry
→ 1111 1000 → negative → magnitude = 0000 0111 = 7 → answer −7 ✓
6. Subtraction with 1's Complement
Use the identity A − B = A + (1's complement of B), then apply the same carry rule.
Example: 7 − 3
0000 0111 (+7)
+ 1111 1100 (1's comp of +3)
───────────
1 0000 0011 → end-around carry → 0000 0100 = +4 ✓
Example: 3 − 7
0000 0011 + 1111 1000 = 1111 1011 → no carry → negative
magnitude = 0000 0100 = 4 → answer −4 ✓
7. Advantages and Limitations
| Advantages | Limitations |
|---|---|
| Toggling a number's sign needs only an inverter (no adder) | Two zeros (+0, −0) complicate comparisons and equality tests |
| Subtraction reduces to addition with the complement | Needs the extra end-around carry step — an extra clock cycle in hardware |
| Easy to implement for small, teaching-oriented circuits | Range is one value smaller than 2's complement (−127 vs −128 in 8 bits) |
| Forms the first step in finding the 2's complement | Not used in modern CPUs (all use 2's complement) |
8. Exam Points
- Explain sign-magnitude, 1's complement and 2's complement representation with the same example — 5-7 marks, very frequent.
- Find the 1's complement of a given positive/negative number — 3 marks.
- Add/subtract two signed 8-bit numbers using 1's complement; explain the end-around carry — 5 marks, frequent.
- What is the dual-zero problem? Which scheme solves it and how? — 3-5 marks.
- State the range of numbers representable in 1's complement for bits — 3 marks.