Number Systems: Question 8
Syllabus 1.1
A drone's flight computer logs the change in altitude, in metres, between two consecutive readings as an 8-bit two's complement binary number, so that both a climb (positive) and a descent (negative) can be stored in the same register. A legacy ground-station application, unaware that the register is meant to be two's complement, sometimes reads the same register as an ordinary unsigned binary number instead.
(a) The drone climbs by 109 m between two readings. Convert +109 (denary) to an 8-bit two's complement binary number. Show your working. [2]
(b) On a later flight, the flight computer's register contains the two's complement pattern 10010011. Convert this to a denary value. Show your working. [3]
(c) The legacy ground-station application reads the same pattern, 10010011, as an ordinary unsigned binary number instead. State the denary value under this (incorrect) interpretation, and explain why the two interpretations give different results. [3]
Show worked solution Hide worked solution
Worked solution
Part (a): +109 to 8-bit two’s complement
Because +109 is a positive value, its two’s complement representation is identical to its ordinary unsigned 8-bit binary representation. The invert-and-add-1 method is only needed for negative values.
Using the binary place values 128, 64, 32, 16, 8, 4, 2, 1:
- 109 - 64 = 45, so the 64 column = 1
- 45 - 32 = 13, so the 32 column = 1
- 13 < 16, so the 16 column = 0
- 13 - 8 = 5, so the 8 column = 1
- 5 - 4 = 1, so the 4 column = 1
- 1 < 2, so the 2 column = 0
- 1 - 1 = 0, so the 1 column = 1
Reading the columns from 128 down to 1 (128 column = 0, since 109 < 128) gives 01101101.
Check: 64 + 32 + 8 + 4 + 1 = 109. Correct. Since bit 7 = 0, this pattern is read as positive under two’s complement, as required.
So +109 in 8-bit two’s complement = 01101101. [2 marks]: [1] for the correct unsigned magnitude, [1] for recognising bit 7 = 0 keeps the value positive with no further conversion needed.
Part (b): 10010011 (two’s complement) to denary
Bit 7 = 1, so this pattern represents a negative value under two’s complement. Reading each bit with its two’s complement place value (bit 7 = -128, and every other bit keeps its usual positive place value: 64, 32, 16, 8, 4, 2, 1):
Bit pattern: 1 0 0 1 0 0 1 1
- bit 7 (-128): 1, so include -128
- bit 6 (64): 0
- bit 5 (32): 0
- bit 4 (16): 1, so include 16
- bit 3 (8): 0
- bit 2 (4): 0
- bit 1 (2): 1, so include 2
- bit 0 (1): 1, so include 1
Adding these: -128 + 16 + 2 + 1 = -109.
So 10010011 = -109. [3 marks]: [1] for reading bit 7 as -128, [1] for including the correct remaining 1 bits (16, 2, 1), [1] for the correct final total, -109.
Check using the invert-and-add-1 method: inverting 01101101 (part (a)‘s answer for +109) gives 10010010, and adding 1 gives 10010011, exactly the pattern in this part. Confirming that 10010011 is indeed the two’s complement representation of -109.
Part (c): The same pattern read as unsigned
Reading 10010011 as an ordinary unsigned binary number, every bit (including bit 7) keeps its usual positive place value:
- bit 7 (128): 1, so include 128
- bit 4 (16): 1, so include 16
- bit 1 (2): 1, so include 2
- bit 0 (1): 1, so include 1
Adding these: 128 + 16 + 2 + 1 = 147.
So under the unsigned interpretation, the pattern represents 147, but under the two’s complement interpretation (part (b)) it represents -109.
The two readings differ because bit 7 is given a different place value in each system: +128 in the unsigned system, but -128 in two’s complement, a difference of 128 - (-128) = 256. This matches the two answers exactly: 147 - (-109) = 256. [3 marks]: [1] for the correct unsigned value, 147, [1] for identifying that bit 7’s place value is the source of the difference, [1] for quantifying the difference as 256.
Final answers
- (a) +109 =
01101101 - (b)
10010011(two’s complement) = -109 - (c)
10010011(unsigned) = 147; the two interpretations differ by exactly 256, the difference between bit 7’s place value of +128 (unsigned) and -128 (two’s complement)