Skip to main content
WalesComputer ScienceSyllabus dot point

How are negative whole numbers stored in binary using sign and magnitude and two's complement?

Representing signed (negative and positive) integers in binary using the sign and magnitude method and the two's complement method, and converting between them.

A focused answer to the WJEC GCSE Computer Science Unit 1 content on representing signed integers in binary, covering the sign and magnitude method, the two's complement method, how to find a two's complement number, and the advantages of two's complement for arithmetic.

Generated by Claude Opus 4.89 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this topic is asking
  2. Why a special method is needed
  3. Sign and magnitude
  4. Two's complement
  5. Reading a two's complement number back to denary
  6. Comparing the methods
  7. Try this

What this topic is asking

WJEC wants you to represent signed whole numbers (positive and negative) in binary using two methods, the sign and magnitude method and the two's complement method, and to explain why two's complement is preferred. This is part of the Data representation and data types content in Unit 1 of WJEC GCSE Computer Science (3500).

Why a special method is needed

Sign and magnitude

Two's complement

Reading a two's complement number back to denary

To convert a two's complement number back to denary, first look at the leftmost bit. If it is 00 the number is positive, so just add the place values as normal. If it is 11 the number is negative, so reverse the process: subtract 11 and then flip every bit to recover the positive magnitude, then attach a minus sign. For example, 1111001111110011 has a leading 11, so subtract 11 to get 1111001011110010, flip to 00001101=1300001101 = 13, giving 13-13. An alternative method treats the most significant bit as a negative place value: in 88 bits the top column is worth 128-128, so 11110011=128+64+32+16+2+1=1311110011 = -128 + 64 + 32 + 16 + 2 + 1 = -13, which gives the same answer.

Comparing the methods

Sign and magnitude is easier to read at a glance, but two's complement is what real processors use because the same simple addition circuit handles both addition and subtraction, there is no awkward double zero, and the range is slightly larger on the negative side (an 88-bit two's complement number runs from 128-128 to +127+127, whereas 88-bit sign and magnitude runs only from 127-127 to +127+127 and wastes a pattern on negative zero).

Try this

Q1. Write 1-1 in 88-bit two's complement. [2 marks]

  • Cue. +1+1 is 0000000100000001; flip to 1111111011111110; add 11 to get 1111111111111111.

Q2. State one advantage of two's complement over sign and magnitude. [1 mark]

  • Cue. Subtraction can be done by addition with a single adder, and there is only one representation of zero.

Exam-style practice questions

Practice questions written in the style of WJEC exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

WJEC-style Unit 12 marksUsing 88-bit two's complement, represent the denary number 20-20 in binary. Show your working.
Show worked answer →

A Unit 1 two's complement question. First write +20+20 in 88-bit binary: 0001010000010100 (1 mark). Then flip all the bits to get 1110101111101011 and add 11, giving 1110110011101100 (1 mark for the final answer). Markers reward the flip-and-add-one method and the correct result. A common error is to forget the add one step, which gives one's complement rather than two's complement, or to start from the wrong positive value.

WJEC-style Unit 13 marksDescribe the two's complement method of representing a negative number and give one advantage of two's complement over sign and magnitude.
Show worked answer →

A Unit 1 describe question. To represent a negative number in two's complement, write the positive value in binary, invert (flip) every bit, then add 11 (1 mark for invert, 1 mark for add one). One advantage is that addition and subtraction work with the same simple binary addition circuit, with no special handling of the sign, so the hardware is simpler and there is only one representation of zero (1 mark for any valid advantage). Markers reward the flip-and-add-one description and a correct advantage. A common error is to confuse two's complement with sign and magnitude, where only the leftmost bit changes.

Related dot points

Sources & how we know this