Cambridge IGCSE · Topic 1.1
IGCSE Computer Science 0478 / Topic 1 / IGCSE

Negative numbers in binary.

A register has no space for a minus sign, so the computer has to show negative numbers with bits alone. Two's complement does it by giving the leftmost bit a negative place value, and it lets the same adding circuits work for positive and negative numbers.

The key idea

In 8-bit two's complement the most significant bit has the place value −128; the other bits are 64, 32, 16, 8, 4, 2, 1 as usual. So a number starting with 1 is negative and one starting with 0 is positive. The range is −128 to +127. To make a negative number, write the positive version in 8 bits, flip every bit, then add 1.

8-bit two’s complement place values −128643216 8421 1110 1100 −128 + 64 + 32 + 8 + 4 = −20 most significant bit 1 = negative, 0 = positive range −128 to +127
Fig. 1: in two's complement the leftmost bit is worth −128, so 11101100 is −20
Section 01

A negative place value.

In the lab, switch the bits on and off. Turning on the leftmost bit subtracts 128, so the number becomes negative.

Worked example Two's complement to denary
Convert the 8-bit two's complement integer 10110110 to denary.
  1. The leftmost bit is 1, so start with −128.
  2. The other 1s are under 32, 16, 4 and 2: 32 + 16 + 4 + 2 = 54.
  3. −128 + 54 = −74.
Answer: −74
Examiner trap

Do not read the leftmost 1 as just a minus sign. 10000101 is −128 + 5 = −123, not −5.

Section 02

Flip and add one.

The lab's negate button shows the method in two steps. Use it on a few numbers, then try the examples by hand.

Worked example Denary to two's complement
Convert −45 to an 8-bit two's complement integer.
  1. Write +45 in 8-bit binary: 00101101.
  2. Flip every bit (0 to 1, 1 to 0): 11010010.
  3. Add 1: 11010010 + 1 = 11010011.
  4. Check: −128 + 64 + 16 + 2 + 1 = −45.
Answer: 11010011
Worked example Negative binary to denary, the other way
Find the denary value of 11111000 by flipping and adding 1.
  1. Flip every bit: 00000111.
  2. Add 1: 00001000 = 8.
  3. The original started with 1, so it is negative.
Answer: −8
Your turn
Convert −100 to an 8-bit two's complement integer.
Stage 1 · Learn

Check what the sim just showed you

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

In 8-bit two's complement, what is the place value of the most significant bit?

Quick check+10 XP

What is the range of an 8-bit two's complement integer?

Quick check+10 XP

Which 8-bit two's complement integer represents −1?

Quick check+10 XP

In the lab, 00000101 is negated by flipping the bits and adding 1. What is the result?

Section 03

Positive and negative side by side.

Every positive number from 0 to 127 has a negative partner. Compare the patterns.

DenaryTwo's complementDenaryTwo's complement
+100000001−111111111
+500000101−511111011
+2000010100−2011101100
+12701111111−12710000001
000000000−12810000000
Examiner trap

+128 cannot be stored in 8-bit two's complement. The largest positive value is +127.

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to IGCSE Paper 1 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

What is the denary value of the 8-bit two's complement integer 10000001?

Exam style+20 XP

Which is −60 as an 8-bit two's complement integer?

Exam style+20 XP

Which 8-bit two's complement integer is positive?

Exam style+20 XP

What is the denary value of the two's complement integer 11111000?

Skill unlocked

Two's complement, mastered.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
Representing positive and negative 8-bit integers in two's complement, and converting in both directions.