Information representation
Negative numbers, binary arithmetic and overflow
What you need to be able to do
- 1.1Represent negative integers in one's complement and two's complement, and convert both ways between denary and two's complement (8-bit, 12-bit …).
- 1.1State the range of an n-bit unsigned or two's complement integer.
- 1.1Perform binary addition and binary subtraction with positive and negative integers, showing the working.
- 1.1Show understanding of how overflow can occur, and spot it in a calculation.
You need: binary place values and denary ↔ binary from Number bases, prefixes and BCD. Logical and arithmetic shifts are syllabus 4.3 and are taught in Chapter 4 (Bit manipulation).
Unsigned and signed integers
So far every pattern meant a positive number: an unsigned integer uses all n bits for size, 0 to \(2^n-1\). A computer has no minus sign to write, so to store negative numbers it must give some bit patterns a negative meaning. Such a number is a signed integer, and the left-hand bit, the most significant bit (MSB), becomes the sign bit: 0 for positive, 1 for negative. The syllabus uses two ways of doing this.
One's complement
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |||
|---|---|---|---|---|---|---|---|---|---|---|
| +45 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | ||
| −45 (one's) | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 |
Denary → one's complement
Write the positive number in n bits, then flip every bit. −120: +120 = 0111 1000 → 1000 0111.
One's complement → denary
Sign bit 0: read it as normal. Sign bit 1: flip every bit back, read the size, put a minus sign in front.
Range (8 bits)
−127 to +127. There are two zeros: 0000 0000 (+0) and 1111 1111 (−0). That wasted pattern, and the awkward arithmetic, are why computers use two's complement instead.
Two's complement
| −128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
For 12 bits the MSB is worth −2048 (\(-2^{11}\)); for 16 bits, −32 768. In general the MSB of n bits is worth \(-2^{n-1}\).
Denary to two's complement
- If the number is positive: write it in binary with a 0 sign bit, padded to the number of bits asked for. Done.
- If it is negative: write the positive version in the full number of bits (e.g. +45 = 0010 1101).
- Flip every bit (one's complement): 1101 0010.
- Add 1: 1101 0010 + 1 = 1101 0011. Check: the sign bit is 1, as a negative must be.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | |||||||||||
| Flipped +45 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | |||
| add 1 | + | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ||
| −45 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 |
Two's complement to denary: two methods, same example (1001 1111)
Method A: give the MSB its negative value
- Write the place values with the MSB negative: −128, 64, 32, 16, 8, 4, 2, 1.
- Add the values that have a 1: −128 + 16 + 8 + 4 + 2 + 1.
- = −128 + 31 = −97.
Method B: undo it with flip and add 1
- The sign bit is 1, so the number is negative.
- Flip every bit: 0110 0000. Add 1: 0110 0001.
- Read that as a normal positive number: 64 + 32 + 1 = 97. Put the minus sign back: −97.
Both methods are in the mark scheme (November 2024): “Flip each bit then add 1 … convert the new binary number into denary” or “Most significant 1 bit is treated as the corresponding negative denary value … add the other positive corresponding denary values”.
Range
| Smallest | Largest | 8-bit example | |
|---|---|---|---|
| Unsigned n bits | 0 | \(2^n-1\) | 0 to 255 |
| One's complement n bits | \(-(2^{n-1}-1)\) | \(2^{n-1}-1\) | −127 to 127 |
| Two's complement n bits | \(-2^{n-1}\) | \(2^{n-1}-1\) | −128 (1000 0000) to 127 (0111 1111) |
1 Negative to 8-bit two's complement
Write −100 as an 8-bit two's complement integer.
Asked8-bit patternKnow+100 = 0110 0100Routeflip, add 1
- Flip: 1001 1011
- Add 1: 1001 1100
Check with Method A: −128 + 16 + 8 + 4 = −100 ✓
2 Negative to 12-bit
Write −196 as a 12-bit two's complement integer.
Asked12-bit patternKnow+196 = 0000 1100 0100Routeflip, add 1 across all 12 bits
- Flip: 1111 0011 1011
- Add 1: 1111 0011 1100
Pad the positive number to the full 12 bits before flipping, or the leading 1s are lost.
3 A 12-bit pattern to denary
1110 0110 0001 is a 12-bit two's complement integer. Find its denary value.
AskeddenaryKnowMSB worth −2048Routeadd the place values
- −2048 + 1024 + 512 + 64 + 32 + 1
- = −2048 + 1633 = −415
4 Positive in two's complement
Write +37 as an 8-bit two's complement integer.
Asked8-bit patternKnowpositiveRouteordinary binary, sign bit 0
- 37 = 32 + 4 + 1 = 0010 0101
Positive numbers look exactly the same as unsigned ones. Flip-and-add-1 is only for negatives.
5 The same pattern, two meanings
What is 1100 1000 as an unsigned integer and as a two's complement integer?
Askedtwo valuesKnowsame bitsRouteMSB +128 or −128
- Unsigned: 128 + 64 + 8 = 200
- Two's complement: −128 + 64 + 8 = −56
The two differ by exactly 256 (\(2^8\)). Treating a two's complement number as unsigned (answering 200) was the most common wrong answer in November 2022.
Binary addition
Add column by column from the right, exactly like denary addition, but you carry as soon as a column reaches 2.
| In the column | Total | Write | Carry |
|---|---|---|---|
| 0 + 0 | 0 | 0 | - |
| 0 + 1 or 1 + 0 | 1 | 1 | - |
| 1 + 1 | 2 = 10₂ | 0 | 1 |
| 1 + 1 + carry 1 | 3 = 11₂ | 1 | 1 |
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | 1 | |||||||
| A | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | |||
| B | + | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | ||
| Answer | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |
Try it yourself. Fill in every answer bit and every carry, right to left, like a dry run. Wrong bits turn pink and the caption tells you why; “New numbers” gives fresh ones (some overflow).
Binary addition workbench
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | ||||||||||
| A | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | |||
| B | + | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | ||
| Answer | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
Binary subtraction
The mark scheme accepts two methods. Both are worked below on the same sum, 100 − 59 (= 41).
Method A: A − B = A + (−B)
- Write both numbers in binary with the same number of bits.
- Make −B: flip every bit of B and add 1 (two's complement).
- Add A + (−B) column by column.
- Ignore the carry out of the left column: in two's complement it is discarded (the scheme writes it in brackets).
| +59 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | ||
| flipped | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | ||
| −59 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 |
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | ||||||||
| 100 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | |||
| −59 | + | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | ||
| 100 − 59 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 |
Method B: subtract column by column, borrowing
- Work from the right. In each column take the bottom bit from the top bit.
- If the top is 0 and the bottom is 1, borrow from the next column to the left: that column loses 1, and this column becomes 10₂ = 2, so 2 − 1 = 1.
- A column that has lent and was 0 must itself borrow from further left (the borrow ripples, like 1000 − 1 in denary).
- Show the borrows: the scheme gives the working mark for visible borrowing.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Lent 1 | 1 | 1 | 1 | 1 | 1 | ||||||
| 100 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | |||
| 59 | − | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | ||
| 100 − 59 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 |
Try it yourself. The workbench below makes you do every step of Method A: flip the bits of B, add 1, then add.
Binary subtraction workbench (A − B)
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | 1 | |||||||
| 90 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | |||
| −45 | + | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | ||
| 90 − 45 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
Overflow
Unsigned numbers
Overflow happens when there is a carry out of the left-hand column. 8 bits hold at most 255; 200 + 100 = 300 needs a ninth bit, so the register keeps only 300 − 256 = 44.
Two's complement numbers
Overflow happens when you add two numbers with the same sign and the answer has the other sign: positive + positive gives a “negative”, or negative + negative gives a “positive”. A carry out of the left column on its own is not overflow here - it is discarded.
Never overflows
Adding a positive to a negative (two's complement) can never overflow: the answer always lies between them.
What the processor does
The overflow is recorded in the status register (an overflow flag) so that software can detect the wrong answer. More in Chapter 4.
1 Unsigned overflow
Add 1100 1000 and 0110 0100 as unsigned 8-bit integers.
Askedresult + overflow?Know200 + 100 = 300 > 255Routecarry out of the MSB?
- Sum: 0010 1100 with a carry out of 1
- 300 needs 9 bits: overflow. The register holds 0010 1100 = 44.
2 Two's complement: positive + positive
Add 0101 0000 and 0011 0000 as 8-bit two's complement.
Askedresult + overflow?Know80 + 48 = 128 > 127Routecheck the sign bits
- Sum: 1000 0000, no carry out
- Two positives gave a negative pattern (−128): overflow.
No carry out, yet still overflow: in two's complement you judge by the sign bits.
3 Two's complement: carry out but no overflow
Add 1111 1100 (−4) and 0000 0110 (+6) as 8-bit two's complement.
Askedresult + overflow?Know−4 + 6 = 2Routedifferent signs: can't overflow
- Sum: (1) 0000 0010: discard the carry
- Answer 0000 0010 = 2 ✓, no overflow
4 Two's complement: negative + negative
Add 1000 0001 (−127) and 1111 1110 (−2) as 8-bit two's complement.
Askedresult + overflow?Know−127 − 2 = −129 < −128Routecheck the sign bits
- Sum: (1) 0111 1111
- Two negatives gave a positive (127): overflow.
Mark-scheme focus
“State what is meant by an overflow in binary addition” (1 mark)
![(c) State what is meant by an overflow in binary addition. [1]](/notes-content/9618/information-representation/img/9618_s24_13_q01_c.png)
- The answer is too long to be represented in the same number of bits as the binary numbers being added
- The answer cannot be represented in the number of bits available // is larger than the maximum positive number (or smaller than the most negative number) that can be stored in the register
- “Bits going off the end” (the November 2021 report: not enough at this level)
- “The number is too big” with no mention of the bits / register
The idea that earns the mark is the fixed number of bits: the result needs more bits than the register has.
For 8-bit unsigned: “the result is greater than 255”. A 2-mark version (November 2025) also credits naming it: “An overflow error occurs”.
From: 9618/13/M/J/24 Q1(c)
“Explain how to convert 10011111 into denary” (3 marks)
![(b) Explain how to convert the two's complement integer 10011111 into denary. Give the denary value after conversion. [3]](/notes-content/9618/information-representation/img/9618_w24_13_q08_b.png)
- Flip each bit then add 1 … B1 then convert the new binary number into denary (and make it negative) B1
- or: the most significant 1 bit is treated as the corresponding negative denary value (−128) B1 … add the other positive denary values B1
- Denary value: −97 B1
- Just the answer −97 (1 of 3)
- Describing the method for unsigned binary (giving 159)
- −97 without a method, or a method without saying the MSB is negative
Two marks are for the method in words. Say what happens to the MSB, not just “add up the place values”.
From: 9618/13/O/N/24 Q8(b)
“Give the 8-bit one's complement representation of −120” (2 marks)
![(b) Give the 8-bit one's complement representation of the denary number −120. Show your working. [2]](/notes-content/9618/information-representation/img/9618_s23_12_q04_b.png)
- Working: +120 = 0111 1000 B1
- Answer: 1000 0111 B1
- 1000 1000 (that is the two's complement)
- 0111 0111 (one's complement of the two's complement)
One's complement stops after the flip. The report says many candidates added 1 out of habit.
From: 9618/12/M/J/23 Q4(b)
Smallest and largest values (3 marks)
![(a) Draw one line from each description to its matching denary value: the smallest integer that can be represented in 8-bit two's complement; the largest integer that can be represented in 8-bit two's complement; the largest unsigned integer that can be represented in 8 bits. Values: 127, −255, −128, −256, 256, 128, 255, −127. [3]](/notes-content/9618/information-representation/img/9618_s23_13_q07_a.png)
- Smallest 8-bit two's complement → −128 B1
- Largest 8-bit two's complement → 127 B1
- Largest unsigned 8-bit → 255 B1
- −127 for the smallest (that is one's complement's limit)
- 256 for the largest unsigned (that is how many values)
The extra negative value exists because two's complement has a single zero.
From: 9618/13/M/J/23 Q7(a)
- Two's complement ↔ denary: almost every paper, 1 mark each (8-bit or 12-bit). Missing minus signs and treating the number as unsigned are the usual losses.
- Addition: 1-3 marks. With 3 marks: working (carries) + answer + overflow indicated (e.g. a three-number sum).
- Subtraction: 2-3 marks: converting the numbers, the method (two's complement and add, or borrowing), the answer.
- Overflow: “state / describe” for 1-2 marks, in about one paper in three.
Worked examples
Example 1 · Two's complement to denary, then a subtraction (Paper 1, 3 marks) ★ Easy
![(a)(iii) Convert the 8-bit two's complement binary integer 11100111 into denary. [1] (b) Perform the following binary subtraction. Show your working. 10110011 − 01110101 [2]](/notes-content/9618/information-representation/img/9618_w22_11_q01_aiiib.png)
(a)(iii) is a negative two's complement number (MSB 1). (b) subtracts the bottom number from the top one: you choose the method, but the working must show.
- 8-bit two's complementMSB = −128
- show your workingborrows, or the two's complement + carries
- (a)(iii)denary value
- (b)binary answer
- 1110 0111(a)
- 1011 0011 − 0111 0101(b)
- (b) as unsigned: 179 − 117
- (a)(iii)denary
- Method A−128 + 64 + 32 + 4 + 2 + 1
- (b)difference
- Chooseborrowing, or add −0111 0101
- Trapdoing it in denary only
Is 1110 0111 negative?
Yes: the MSB is 1. The answer must have a minus sign.
What should (b) come to?
179 − 117 = 62, so expect 0011 1110.
5 Now solve it have a go on paper first, then open the worked solution
- (a)(iii) −128 + 64 + 32 + 4 + 2 + 1 = −25 B1
- (b) borrowing column by column (the 1s mark columns that lent):
- Answer 0011 1110 B1 B1 (working + answer)
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Lent 1 | 1 | 1 | 1 | 1 | 1 | ||||||
| 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | ||||
| − | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | |||
| Answer | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
Method A also scores: −0111 0101 = 1000 1011, then 1011 0011 + 1000 1011 = (1) 0011 1110.
62 in denary ✓. The report: “when the question asks for the subtraction to be completed in binary no working marks will be awarded for converting to denary”.
Example 2 · A 12-bit number with a method, then addition and the error it can cause (Paper 1, 5 marks) ★★ Medium
![(a)(iii) Convert the 12-bit two's complement binary integer 111110111100 into denary. Show your working. [2] (b)(i) The following binary addition is performed using 8-bit registers: 10110011 + 01111000. Complete the calculation using binary addition. [1] (ii) Name and describe the error that can occur when binary addition is performed. [2]](/notes-content/9618/information-representation/img/9618_w25_11_q01_aiiib.png)
A 12-bit two's complement number: the MSB is worth −2048. Then an 8-bit addition whose true answer needs 9 bits, which leads into (b)(ii).
- 12-bitMSB worth −2048
- 8-bit registersonly 8 bits are kept
- name and describe1 mark for the name, 1 for what it means
- (a)(iii)denary
- (b)(i)8-bit sum
- (b)(ii)the error
- 1111 1011 1100(a)
- 1011 0011 + 0111 1000(b)
- (a)(iii)denary
- Flip, add 10000 0100 0100 = 68 → −68
- or−2048 + 1024 + 512 + …
- (b)sum
- Traplosing the carry out
- (ii)overflow: too big for the bits
How many bits does (b)'s true answer need?
179 + 120 = 299 > 255, so 9 bits: there is a carry out.
Faster way for (a)?
Flip and add 1 gives a small positive number to read: 68.
5 Now solve it have a go on paper first, then open the worked solution
- (a)(iii) Flip: 0000 0100 0011; add 1: 0000 0100 0100 = 68 M1
- So the value is −68 A1
- (b)(i) column by column, carries shown:
- Answer (1) 0010 1011 B1
- (b)(ii) An overflow (error) occurs B1: the answer cannot be represented in the number of bits available / is larger than the maximum the register can store B1
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | 1 | |||||||
| A | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | |||
| B | + | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | ||
| Answer | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 |
(a): −2048 + 1024 + 512 + 256 + 128 + 32 + 16 + 8 + 4 = −68 ✓ (the scheme's Method 2).
Example 3 · Adding three numbers with overflow (Paper 1, 3 marks) ★★ Medium
![Complete the binary addition. Show your working. 10011110 + 01100001 + 00011001 [3]](/notes-content/9618/information-representation/img/9618_s24_11_q07.png)
Three rows instead of two. A column can now total 4 or 5 with carries, so a carry can be worth 2 columns: 3 marks are working, answer and showing the overflow.
- show your workingcarries visible
- three numbersa column total can be up to 3 + carries
- Wholethe 8-bit sum
- 1001 1110
- 0110 0001
- 0001 1001
- 158 + 97 + 25 = 280
- Sum8 bits
- Two at a timeadd the first two, then the third
- Trapforgetting the final carry
Can 280 fit in 8 bits?
No: the largest is 255, so expect a carry out → overflow.
Simplest safe method?
Add the first two numbers, then add the third to that result.
5 Now solve it have a go on paper first, then open the worked solution
- First two: 1001 1110 + 0110 0001 = 1111 1111 (no carries at all)
- Then 1111 1111 + 0001 1001: every column carries
- Answer 0001 1000 B1, working with carries B1, overflow clearly indicated (the (1) carried out) B1
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||
| 1111 1111 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||
| 0001 1001 | + | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | ||
| Answer | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 |
158 + 97 + 25 = 280; 280 − 256 = 24 = 0001 1000 ✓
Example 4 · Adding 15, then taking 10 away - the right way round (Paper 1, 6 marks) ★★★ Hard
![(c) One of the colours used in the image has the hexadecimal colour code #FC238A. FC is the amount of red, 23 is the amount of green and 8A is the amount of blue. (i) Convert the hexadecimal code FC into denary. [1] (ii) The amount of green in binary is 00100011. This has the denary number 15 added to it to create a second colour. Add the denary number 15 to 00100011 and give your answer in binary. Perform the addition in binary. Show your working. [3] (iii) Hexadecimal 23 in two's complement representation is 00100011. The denary number 10 needs to be subtracted from this value. Subtract the denary number 10 from 00100011. Give your answer in binary. Show your working. [3]](/notes-content/9618/information-representation/img/9618_s21_11_q01_c.png)
Why it is hard: the report: “a common error was to perform the subtraction the wrong way round and take the two's complement of hexadecimal 23 instead of the two's complement of denary 10”.
A colour code gives the setting: green = hex 23 = 0010 0011. Two binary calculations follow, each 3 marks: convert the denary number, do the arithmetic in binary, answer.
- perform the addition in binaryno marks for denary arithmetic
- subtract 10 from 2323 − 10: it is 10 that becomes negative
- (i)FC in denary
- (ii)35 + 15 in binary
- (iii)35 − 10 in binary
- FC(i)
- 0010 0011 (= 35)(ii), (iii)
- 15, 10denary
- (iii)35 − 10
- −100000 1010 → flip → +1 = 1111 0110
- Add0010 0011 + 1111 0110
- Trapmaking 0010 0011 negative
FC in denary?
15 × 16 + 12 = 252.
Which number gets the flip-and-add-1?
The one being subtracted: 10.
5 Now solve it have a go on paper first, then open the worked solution
- (i) FC = 15 × 16 + 12 = 252 B1
- (ii) 15 = 0000 1111 B1; add with carries shown B1; answer 0011 0010 B1
- (iii) −10 = 1111 0110 B1; add 0010 0011 + 1111 0110 B1; discard the carry: 0001 1001 B1
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | 1 | |||||||
| 35 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | |||
| 15 | + | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | ||
| (ii) | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Carries | 1 | 1 | 1 | 1 | 1 | ||||||
| 35 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | |||
| −10 | + | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | ||
| (iii) | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
(ii) 35 + 15 = 50 = 0011 0010 ✓. (iii) 35 − 10 = 25 = 0001 1001 ✓.
Summary
- Sign bit (MSB): 0 positive, 1 negative.
- One's complement: flip all the bits of the positive number. Two zeros; 8-bit range −127 to 127.
- Two's complement: MSB worth −128 (8-bit), −2048 (12-bit). Negative: flip the positive and add 1. 8-bit range −128 to 127.
- Addition: carry at 2. Subtraction: A + (−B), discard the final carry; or borrow.
- Overflow: the result does not fit the bits. Unsigned: carry out. Two's complement: same-sign inputs, other-sign answer.
| If you see… | do this |
|---|---|
| “two's complement” and MSB 1 | negative: −128 + the rest, or flip + 1, then a minus sign |
| “12-bit” | MSB −2048; pad positives to 12 bits before flipping |
| “one's complement of −n” | flip +n, and stop |
| “subtract x from y” | y − x: make x negative and add |
| “show your working” | carries / borrows visible, answer labelled |
| “name and describe the error” | overflow + the result needs more bits than are available |
Can I do this?
- I can write a negative number in one's complement and know why it is rarely used.
- I can convert denary ↔ two's complement in 8 and 12 bits, both methods.
- I know the ranges: unsigned 0 to 255, two's complement −128 to 127 (8-bit), and the bit patterns.
- I can add binary numbers (including three of them) showing the carries.
- I can subtract in binary by adding the two's complement, the right way round, or by borrowing.
- I can define overflow and say whether a sum overflows, for unsigned and for two's complement.
Anything unticked: revise that section first. All ticked: take the quiz.
Quiz
The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.
Concept checks
Answer each one in your head first, then open it.
1Why does flipping the bits and adding 1 give the negative?Show answer
A number plus its flip is all 1s (1111 1111 = −1 in two's complement). So x + flip(x) = −1, which means flip(x) + 1 = −x.
2Why can adding a positive and a negative never overflow?Show answer
The answer always lies between the two numbers, and both of them fit in the bits, so the answer fits too.
3Why is a carry out an overflow for unsigned numbers but not for two's complement?Show answer
Unsigned: the carry is a real 256s bit that has nowhere to go. Two's complement: adding −B is like adding 256 − B; the extra 256 is exactly the carry out, so dropping it gives the right answer.
4How can the same 8 bits be both 200 and −56?Show answer
Bits have no meaning on their own. The program decides whether a register holds unsigned or two's complement data; the two readings differ by 256.
Exam-style practice
New questions, not used above. Do them on paper, then mark your work against the official mark scheme.
![(b)(i) Convert the two's complement binary integer 11100010 into denary. [1] (ii) Write the smallest and the largest two's complement binary integers that can be represented in 8 bits. [2]](/notes-content/9618/information-representation/img/9618_s25_12_q02_b.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (b)(i) | −30 | B1 | −128 + 64 + 32 + 2 |
| (b)(ii) | Smallest: 1000 0000 | B1 | |
| Largest: 0111 1111 | B1 | bit patterns, not −128 / 127 | |
| Total: 3 marks | |||
![(b) Subtract the denary number 10 from the denary number 100 using binary subtraction. Show your working. [3]](/notes-content/9618/information-representation/img/9618_s24_12_q07_b.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (b) | Converting 100 to binary 0110 0100 and 10 to binary 0000 1010 | B1 | |
| Method: converting 10 to −10 (1111 0110) and adding // direct subtraction with borrows shown | B1 | ||
| Correct answer 0101 1010 | B1 | = 90 | |
| Total: 3 marks | |||
![(b)(ii) Convert the two's complement binary number 100110010111 into denary. [1] (c) Subtract the denary number 23 from the two's complement binary number 01001010. Perform this calculation using binary subtraction. Show your working. [2] (d) State one reason why binary addition and subtraction can result in overflow. [1]](/notes-content/9618/information-representation/img/9618_w24_11_q01_biicd.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (b)(ii) | −1641 | B1 | 12-bit: −2048 + 256 + 128 + 16 + 4 + 2 + 1 |
| (c) | Working: 23 = 0001 0111, so −23 = 1110 1001; 0100 1010 + 1110 1001 // direct subtraction | B1 | |
| Answer 0011 0011 | B1 | = 51 | |
| (d) | The answer cannot be represented in the number of bits available // is larger than the maximum (or smaller than the most negative) number the register can store | B1 | |
| Total: 4 marks | |||
(e) Convert the denary numbers 127 and 12 to 8-bit binary and then perform the subtraction 12 − 127 in binary.
Show your working.
- 127 in binary …… 12 in binary …… 12 − 127 in binary ……[3]
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (e) | 127 = 0111 1111 and 12 = 0000 1100 | B1 | all 8 bits |
| Working, e.g. two's complement of 127 = 1000 0001, added to 0000 1100 | B1 | ||
| Answer: 1000 1101 | B1 | = −115 | |
| Total: 3 marks | |||
Examiner tip 12 − 127 is negative, so the answer starts with a 1 and there is no carry out to drop.
![(b) Complete the following binary addition. Show your working. Include any overflow bit(s). 11110101 + 10110001 [1] (c) Subtract the binary number 00011110 from the binary number 01100100 using binary subtraction. Show your working. [2]](/notes-content/9618/information-representation/img/9618_s25_13_q07_bc.png)
Show the mark scheme
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| (b) | (1) 1010 0110 | B1 | the overflow bit must be shown |
| (c) | Binary subtraction shown (direct with borrows, or adding the two's complement 1110 0010) | B1 | |
| Answer 0100 0110 | B1 | 100 − 30 = 70 | |
| Total: 3 marks | |||
Your progress on this note is saved when JavaScript is on.