Floating point representation
Floating point stores real numbers as a mantissa and an exponent, like standard form in binary. It covers a far wider range than fixed point for the same number of bits, at the cost of some precision.
Part 1 of 3: Learn it
In short
- Value = mantissa × 2^exponent, with both in two's complement.
- The binary point sits after the first bit of the mantissa.
- A normalised positive mantissa starts 01; a normalised negative one starts 10.
Where this is in your specification
Spec points: AQA 7517 4.5.5, OCR H446 1.4.1
| Board | Topic: Number representation |
|---|---|
| AQA 7517 | 4.5.4 to 4.5.6 (fixed and floating point, error checking, Vernam, analogue and digital, media) |
| OCR H446 | 1.4.1 (data types: floating point, bitwise manipulation, sign and magnitude), 1.3.1 (compression and encryption) |
| Higher C816 76 | Computer systems: data representation (floating point) |
Reading a floating point number
- Work out the exponent in two's complement. With 4 bits, 0011 is 3 and 1110 is −2.
- Write the mantissa with the binary point after the first bit. Its place values are −1, ½, ¼, ⅛, ...
- Move the binary point right by the exponent (left if it is negative), then convert, or multiply the mantissa value by 2 to the exponent.
Normalisation
A number is normalised when the first two bits of the mantissa are different: 01 for positive, 10 for negative. To normalise, shift the mantissa left until that is true, and reduce the exponent by the number of places shifted.
Normalising gives the most precision possible for the mantissa size, and makes every number's representation unique.
Range and precision
With a fixed total number of bits, more mantissa bits give more precision (more significant figures); more exponent bits give a larger range. Some values, such as 0.1, cannot be stored exactly in binary, which causes rounding errors. The absolute error is the difference between the true and stored value; the relative error is that difference divided by the true value.
What is the 4-bit two's complement exponent 1111 in denary?
Show the answer
−1.
Part 2 of 3: See it worked
Worked examples
Example 1
Convert this to denary: mantissa 0.1010000, exponent 0011 (both two's complement).
- Exponent 0011 = 3
- Move the point 3 places right: 0101.0000
- 0101 = 5
Answer: 5.
Example 2
Convert to denary: mantissa 1.0110000, exponent 0010.
- Mantissa: −1 + ¼ + ⅛ = −0.625
- Exponent 0010 = 2
- −0.625 × 2² = −2.5
Answer: −2.5.
Example 3
Normalise mantissa 0.0011010 with exponent 0101.
- Shift the mantissa left 2 places so it starts 01: 0.1101000
- Exponent goes down by 2: 5 − 2 = 3, which is 0011
- Check: 0.1101 × 2³ = 0.8125 × 8 = 6.5, and 0.0011010 × 2⁵ = 0.203125 × 32 = 6.5
Answer: Mantissa 0.1101000, exponent 0011.
Common mistakes
- Treating the first mantissa bit as +1 instead of −1.
- Reading the exponent as an unsigned number.
- Shifting the mantissa when normalising but not changing the exponent.
- Saying more mantissa bits increase the range. They increase precision.
Is the mantissa 1.1010000 normalised?
Show the answer
No: a negative normalised mantissa must start 10, and this starts 11.
Part 3 of 3: Test yourself
Check yourself
Answer each one in your head or on paper first, then open it to check.
What is the 4-bit two's complement exponent 1111 in denary?
−1.
Is the mantissa 1.1010000 normalised?
No: a negative normalised mantissa must start 10, and this starts 11.
Why are floating point numbers normalised?
To give the greatest precision for the mantissa size and a unique representation for each value.
Jobs that use this
Each link opens the job profile on the National Careers Service (England). In the rest of the UK: My World of Work (Scotland), Careers Wales, nidirect careers (Northern Ireland).
Full lessons and marked practice for this course are coming soon to Brainlag Learn. See courses