← 🔢 Number Representation & Computer Arithmetic
Subtopic 1 of 9

4.1Unsigned & signed formats

The idea

The same bits mean different numbers depending on the format. 2's complement wins because addition and subtraction work without special cases.

Think of it like this: A car odometer: roll backwards from 0000 and you get 1111, which can be read as −1.

Why it exists

The CPU needs negative numbers, and the hardware adder should not care about signs.

How it works

  1. Sign-magnitude: top bit = sign, rest = size (has +0 and −0).
  2. 1's complement: negative = invert all bits (also two zeros).
  3. 2's complement: negative = invert and add 1; one zero; range −2n−1 to 2n−1−1.
  4. The leftmost bit is the sign bit in all signed formats.

Worked example: 4-bit pattern 1011

Unsigned 11. Sign-magnitude −3. 1's complement −4. 2's complement −5 (11 − 16).

Now play with it

  • →Click bits to set 1011 and read all four values.
  • →Set 0000 then 1000 to see the two zeros.
Unsigned11
Sign-magnitude-3
1's complement-4
2's complement-5

Click bits to flip them. Red = sign bit. Range of 2's complement: -8 to 7. Try 1000 and 0000 / 1111 to see the double zero in sign-magnitude and 1's complement.

Check yourself

What is the range of an 8-bit 2's complement number?

Remember: 2's complement: one zero, one extra negative, adders just work.
Exam notes (the dense version)

Sign-magnitude, 1's complement (two zeros), 2's complement (one zero, used everywhere). 2's complement of x = invert bits + 1.

Previous year questions: Number Representation & Computer Arithmetic (19)

PYQs are grouped by topic, so this is the full set for Number Representation & Computer Arithmetic; try the ones that match this subtopic. Open all 19 on the topic page.