Advanced Data Representation and File Organisation: Question 4
Syllabus 13.3
A sensor logging system stores real numbers using binary floating-point representation with:
- 8 bits for the mantissa
- 4 bits for the exponent
- two's complement form for both the mantissa and the exponent
- the mantissa's binary point placed immediately to the right of its sign bit, so the mantissa represents a fraction between -1 and +1, which is then multiplied by 2 raised to the power of the exponent.
(a) Write the normalised floating-point representation (mantissa and exponent, in binary) of the denary value +22. Show your working. [3]
(b) Write the normalised floating-point representation (mantissa and exponent, in binary) of the denary value -22, using the same format. Show your working. [3]
(c) State the rule that identifies a mantissa as normalised, and confirm that your answer to part (b) satisfies it. [2]
Show worked solution Hide worked solution
Worked solution
Part (a): Normalising +22
Step 1, convert 22 to binary. Using bit values 16, 8, 4, 2, 1:
16 + 4 + 2 = 22
So 22 = 10110 in binary.
Step 2. Write this as a normalised fraction multiplied by a power of 2. The integer 10110
is the same value as the binary point shifted 5 places to the left:
10110 = 0.10110 x 2^5
Check: 0.10110 in binary = 1×2⁻¹ + 0×2⁻² + 1×2⁻³ + 1×2⁻⁴ + 0×2⁻⁵ = 0.5 + 0.125 + 0.0625 =
0.6875, and 0.6875 × 2⁵ = 0.6875 × 32 = 22. ✓
Since 22 is positive, the mantissa’s sign bit is 0, and the fraction 0.10110 already starts
with a 1 immediately after the point, so it is already normalised.
Step 3, fit the mantissa into 8 bits (1 sign bit + 7 fraction bits) and the exponent into 4
bits. Pad the fraction 10110 with zeros on the right to fill 7 bits: 1011000.
Mantissa = 0 1011000 -> 01011000
Exponent = 5 in 4-bit two's complement = 0101
So Mantissa = 01011000, Exponent = 0101.
[3 marks]: [1] for the correct binary conversion of 22 (10110), [1] for correctly
expressing it as a normalised fraction × 2⁵, [1] for the correct final 8-bit mantissa and
4-bit exponent.
Part (b): Normalising -22
The magnitude of -22 is the same as +22, so the representation is found by taking the two’s
complement of the mantissa from part (a). The exponent does not change, because the size of
the number has not changed, only its sign.
Step 1. Invert every bit of the mantissa 01011000:
01011000 -> 10100111
Step 2. Add 1:
10100111
+ 00000001
-----------
10101000
So the mantissa for -22 is 10101000, with the exponent unchanged at 0101.
Check: mantissa 10101000 has sign bit 1 (negative) and fraction bits 0101000, giving
-1 + (0×2⁻¹ + 1×2⁻² + 0×2⁻³ + 1×2⁻⁴) = -1 + (0.25 + 0.0625) = -0.6875. Multiplying by
2⁵ = 32 gives -0.6875 × 32 = -22. ✓
[3 marks]: [1] for the correct method (two’s complement of the mantissa, exponent unchanged), [1] for correctly inverting and adding 1, [1] for the correct final mantissa and exponent.
Part (c): Confirming normalisation
A binary floating-point mantissa is normalised when it has no wasted leading bit:
- If the mantissa is positive (sign bit
0), the bit immediately after the sign bit must be1, giving the form0.1.... - If the mantissa is negative (sign bit
1), the bit immediately after the sign bit must be0, giving the form1.0....
This rule ensures the maximum number of significant bits are used to represent the value for a given exponent, which gives the greatest possible precision.
The mantissa found in part (b) is 10101000: the sign bit is 1, and the very next bit is 0,
so it satisfies the negative-mantissa normalisation rule and is correctly normalised.
[2 marks]: [1] for correctly stating the normalisation rule (for both signs, or at least the negative case), [1] for correctly confirming it against the mantissa from part (b).
Final answers
- (a)
+22→ Mantissa01011000, Exponent0101 - (b)
-22→ Mantissa10101000, Exponent0101 - (c) Normalised: positive mantissas start
0.1..., negative mantissas start1.0...;10101000satisfies this (sign bit1followed by0).