Number Systems: Question 4

Syllabus 1.1

Structured 8 marks

A temperature-logging sensor stores its readings, in degrees Celsius, as 8-bit two's complement binary numbers, so that both positive and negative temperatures can be recorded.

(a) Convert the denary value -53 to an 8-bit two's complement binary number. Show your working. [3]

(b) An 8-bit two's complement register contains the binary pattern 11010110. Convert this to a denary value. Show your working. [3]

(c) Explain how the bit in the leftmost position (bit 7) of an 8-bit two's complement number shows whether the value it represents is positive or negative, referring to one of your answers from (a) or (b). [2]

Show worked solution Hide worked solution

Worked solution

Part (a): -53 to 8-bit two’s complement

Step 1: Write +53 as an ordinary 8-bit binary number. 53 = 32 + 16 + 4 + 1, so 53 = 00110101.

Step 2: Invert every bit (change each 0 to a 1 and each 1 to a 0). Inverting 00110101 gives 11001010.

Step 3: Add 1 to the inverted value. 11001010 + 1 = 11001011.

So -53 in 8-bit two’s complement = 11001011.

Check: reading 11001011 with bit 7 worth -128 and the rest worth their usual positive place values: -128 + 64 + 8 + 2 + 1 = -53. Correct. Also, adding 00110101 (53) and 11001011 (-53) using binary addition gives 00000000 once the final carry out of bit 7 is discarded, confirming the two values are opposites.

Part (b): 11010110 to denary

Since bit 7 = 1, this pattern represents a negative value. 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):

11010110 = -128 + 64 + 16 + 4 + 2

Adding these: -128 + 64 = -64; -64 + 16 = -48; -48 + 4 = -44; -44 + 2 = -42.

So 11010110 = -42.

Check using the invert-and-add-1 method: inverting 11010110 gives 00101001, and adding 1 gives 00101010, which equals 32 + 8 + 2 = 42. Since the original pattern had bit 7 = 1 (negative), the value is -42, matching the answer above.

Part (c): The role of bit 7 (the sign bit)

In an 8-bit two’s complement number, bit 7 is given a negative place value (-128), while every other bit keeps its usual positive place value. If bit 7 = 0, no negative amount is included in the total, so the overall value is positive or 0. If bit 7 = 1, the total includes -128, which is a bigger negative amount than every other bit combined can offset (their maximum total is 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127), so the overall value must be negative.

For example, in part (b), 11010110 has bit 7 = 1, so -128 is included in the total, and the value works out to -42, a negative number, as bit 7 = 1 indicated it would be. Because bit 7 alone decides whether the represented value is positive or negative, it is called the “sign bit”.

Final answers

  • (a) -53 = 11001011
  • (b) 11010110 = -42
  • (c) Bit 7 carries a place value of -128 in two’s complement: it is 1 for negative values (as in part (b), where bit 7 = 1 and the value is -42) and 0 for positive values or zero.