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.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
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 the number is positive, so just add the place values as normal. If it is the number is negative, so reverse the process: subtract and then flip every bit to recover the positive magnitude, then attach a minus sign. For example, has a leading , so subtract to get , flip to , giving . An alternative method treats the most significant bit as a negative place value: in bits the top column is worth , so , 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 -bit two's complement number runs from to , whereas -bit sign and magnitude runs only from to and wastes a pattern on negative zero).
Try this
Q1. Write in -bit two's complement. [2 marks]
- Cue. is ; flip to ; add to get .
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 -bit two's complement, represent the denary number in binary. Show your working.Show worked answer →
A Unit 1 two's complement question. First write in -bit binary: (1 mark). Then flip all the bits to get and add , giving (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 (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
- The binary and denary number systems, why computers store data in binary, the units of data capacity, and converting whole numbers between binary and denary.
A focused answer to the WJEC GCSE Computer Science Unit 1 content on binary and denary numbers, covering why computers use binary, bits bytes and the units of data capacity, place value in base 2, and converting whole numbers between binary and denary in both directions.
- Adding two binary numbers using the carry rules, the meaning of overflow, and using arithmetic (binary) shifts to multiply and divide by powers of two.
A focused answer to the WJEC GCSE Computer Science Unit 1 content on binary arithmetic, covering adding two binary numbers with the carry rules, the meaning and cause of overflow, and using left and right arithmetic shifts to multiply and divide a binary number by powers of two.
- The hexadecimal number system, why hexadecimal is used as a shorthand for binary, and converting between hexadecimal, binary and denary.
A focused answer to the WJEC GCSE Computer Science Unit 1 content on hexadecimal, covering the base 16 number system, why hexadecimal is a convenient shorthand for binary, and converting between hexadecimal, binary and denary in both directions with worked examples.
- Representing characters in binary using character sets, the ASCII and Unicode character sets, and the relationship between a character, its character code and the number of bits needed.
A focused answer to the WJEC GCSE Computer Science Unit 1 content on representing text, covering character sets, the ASCII character set and its size, the Unicode character set and why it was introduced, character codes, and how the number of bits limits the number of characters.
- The common data types, the use of data structures such as arrays and records, and the difference between validation and verification.
A focused answer to the WJEC GCSE Computer Science Unit 1 content on data organisation, covering the common data types (integer, real, Boolean, character and string), data structures such as arrays and records, and the difference between validation and verification with examples of each technique.