📁 Paper 1 · Topic 1: Data Representation
1.1b Negative Numbers: Two's Complement & Sign & Magnitude
Cambridge IGCSE Computer Science 0478 · ~13 min read · ⭐ Pro
Notes
──
Worksheet
──
Quiz

Representing Negative Numbers in Binary

Computers need to represent negative numbers in binary. Two methods are used: sign and magnitude and two's complement. Cambridge 0478 requires you to know both.

Sign and Magnitude

The most significant bit (MSB) — the leftmost bit — is used as a sign bit: 0 means positive, 1 means negative. The remaining bits represent the magnitude (size) of the number.

BinarySign bitMagnitudeValue
000001010 (positive)0000101+5
100001011 (negative)0000101–5

Problem with sign and magnitude: There are two representations of zero (+0 = 00000000, –0 = 10000000), and arithmetic is complex to implement in hardware.

Two's Complement

Two's complement is the method actually used in modern computers. It allows straightforward binary addition for both positive and negative numbers.

Range of values (8-bit two's complement)

  • The MSB has a place value of –128 (negative of 2⁷)
  • Range: –128 to +127
Bit position–1286432168421
Example10110100

Example: 10110100 in two's complement = –128 + 32 + 16 + 4 = –76

Converting a positive number to a negative two's complement number

  1. Write the positive number in binary
  2. Invert all bits (flip 0s and 1s)
  3. Add 1

Example: Convert +13 to –13 in two's complement (8-bit):

  • +13 = 00001101
  • Invert: 11110010
  • Add 1: 11110011
  • Check: –128+64+32+16+2+1 = –128+115 = –13 ✓

Adding two's complement numbers

Add as normal binary. Any carry out of the MSB is discarded.

Example: 5 + (–3) = 2

  • 5 = 00000101, –3 = 11111101
  • Sum: 100000010 → discard carry → 00000010 = 2 ✓
Exam tip: In Cambridge 0478, two's complement is the preferred method for representing negative numbers in hardware. If asked for the range of an n-bit two's complement number, it is –2^(n-1) to 2^(n-1)–1. For 8 bits: –128 to +127.
⚠️ Common Mistakes
  • Forgetting that the MSB in two's complement has a negative place value (–128 not +128)
  • Forgetting to add 1 after inverting when converting to two's complement
  • Confusing sign and magnitude with two's complement
  • Claiming the range of 8-bit two's complement is –127 to +127 (it's –128 to +127)
Video coming soon
This lesson video is in production

Key points

  • Sign and magnitude: MSB is the sign bit, 0=positive, 1=negative
  • Two's complement: invert all bits then add 1 to negate a number
  • MSB in two's complement has value –2^(n-1)
  • 8-bit two's complement range: –128 to +127
  • Binary addition works naturally with two's complement
Click slide or press arrow keys to navigate
✍️

Worksheet — 1.1b Negative Numbers

5 questions · 11 marks · instantly marked

Q1State what is meant by sign and magnitude representation of a binary number.[2 marks]
✅ Mark scheme
The most significant bit (MSB) is used as the sign bit [1]; 0 indicates positive, 1 indicates negative, and the remaining bits represent the magnitude/size [1]
Q2Convert +19 to its 8-bit two's complement representation. Show your working.[2 marks]
✅ Mark scheme
+19 = 00010011 [1]; (note: two's complement of a positive number is just its binary representation) [1]
Q3Convert –19 to its 8-bit two's complement representation. Show all steps.[3 marks]
✅ Mark scheme
+19 = 00010011 [1]; invert to 11101100 [1]; add 1 = 11101101 [1]
Q4What is the denary value of the two's complement binary number 11001100?[2 marks]
✅ Mark scheme
MSB has value –128 [1]; –128+64+8+4 = –52 [1]
Q5State the range of values that can be represented by an 8-bit two's complement number.[2 marks]
✅ Mark scheme
–128 [1] to +127 [1]
Topic Quiz
Question 1 of 10
You scored
out of 10
Card 1 of 6
Click to reveal definition
🎉
Done!
TermDefinition
🎯

Mini Test — 1.1b Negative Numbers

Timed exam-style conditions.

  • 8 questions · 10 marks · 10 minutes
  • 5 MCQ + 3 short answer
← 1.1a Binary & Hex Topic 1: Data Representation Next: 1.1c Binary Arithmetic →
🔒
Pro Content
This lesson requires a CSZone Pro subscription.
£7.99/month
or £59/year
Subscribe now →