9618/31/M/J/21 question 1: worked solution (May/June 2021, paper 31)

Show as plain text

Cambridge A2 Level Computer Science 9618 · 13.3 Floating-point numbers, representation and manipulation Worked solution from the Data Representation Paper 3 Advanced Theory booklet, Part 3 of 3. Q34 9618/31/M/J/21 original Q1 Structured · 14 marks Worked solution (a) Change 7.25 to binary: 7 = 111 and 0.25 = 0.01, so 7.25 = 111.01. Put the binary point after the sign bit and before the first 1: 0.11101 × 2³. Move the point 3 places, so the exponent is 3 . Exponent 3 = 000011 [1] 10-bit mantissa for +7.25: 0111010000 [1] Make it negative with two's complement. Invert: 1000101111. Add 1: 1000110000. Mantissa Exponent 1000110000 000011 Correct final mantissa and exponent [1] (b) Exponent 000111 = 7 , so move the binary point 7 places to the right [1] Mantissa 1011000111 with the point after the first bit is 1.011000111. Move it 7 places: 10110001.11 [1] Evaluate with a negative first place value: –128 + 32 + 16 + 1 + 0.5 + 0.25 Write: –78.25 [1] (c) Exponent 100111 = –32 + 7 = –25. The mantissa 0000000111 begins 00, so shift it left until it begins 01. Move the mantissa 6 places left and subtract 6 from the exponent, so the number keeps its value [1] Mantissa: 0111000000 [1] Exponent: –25 – 6 = –31 = 100001 [1] (d)(i) 513 in binary is 1000000001, which needs 10 bits [1] As a normalised positive mantissa it is 0.1000000001, so it needs a sign bit as well: 11 bits but only 10 are available [1] The largest number this system can store is 511, so 513 is too big and gives overflow [1] (d)(ii) Give more bits to the mantissa and fewer to the exponent, keeping 16 bits in total. Increase the number of bits for the mantissa [1] For example 11 or 12 bits for the mantissa and 5 or 4 bits for the exponent [1] KEY IDEA Normalise by moving the binary point and adjusting the exponent; more mantissa bits give more precision, more exponent bits give more range. TOTAL 14 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.