Floating Point Numbers
Representing fractions in binary
To store numbers with fractional parts (and very large/small numbers), computers use floating point representation — the binary equivalent of standard form. A floating point number is split into two parts:
number = mantissa × 2^exponent
- The mantissa (or significand) holds the significant digits.
- The exponent says where the binary point goes (how far to shift it).
Both are stored in a fixed number of bits (e.g. an 8-bit mantissa and a 4-bit exponent), usually in two's complement so both can be negative.
Normalisation
A floating point number is normalised to use the available bits most precisely and to give a unique representation. For a two's complement mantissa:
- Positive numbers start 0.1… (a 0 sign bit followed by a 1).
- Negative numbers start 1.0… (a 1 sign bit followed by a 0).
Normalising means shifting the mantissa so the first two bits differ, and adjusting the exponent to compensate. This maximises the number of significant figures stored.
The precision–range trade-off
For a fixed total number of bits:
- More mantissa bits → greater precision (accuracy of the value).
- More exponent bits → greater range (how large or small a number can be).
- Increasing one reduces the other — a key design trade-off.
Errors
- Rounding/representation errors: many decimals (e.g. 0.1) cannot be stored exactly in binary, causing small inaccuracies.
- Absolute error = the actual difference; relative error = error as a proportion of the true value.
- Overflow (number too large for the exponent) and underflow (too small) can also occur.
Fixed vs floating point
- Fixed point places the binary point at a set position — simpler and faster, but limited range.
- Floating point moves the point (via the exponent) — much larger range and better for scientific values, but more complex and can be less precise.
Worked example
Why is the mantissa normalised before storing?
- Normalising shifts out leading redundant bits so the mantissa carries the maximum number of significant figures, giving the greatest precision for the bits available (and a unique representation). ✓
Common mistakes
- Mixing up the roles: mantissa = significant digits, exponent = position of the point.
- Forgetting normalised two's complement starts 0.1 (positive) or 1.0 (negative).
- Thinking more bits fixes everything — there's always a precision vs range trade-off.
Exam tips
- Be able to state what the mantissa and exponent represent and write
number = mantissa × 2^exponent. - Explain normalisation in terms of maximising precision.
- Discuss the precision–range trade-off and sources of rounding error.
Key facts to remember
- Floating point: mantissa × 2^exponent; mantissa = significant figures, exponent = position of the binary point (often two's complement).
- Normalised two's complement mantissa starts 0.1 (positive) / 1.0 (negative) → maximum precision.
- Fixed bits give a precision (mantissa) vs range (exponent) trade-off; not all decimals store exactly → rounding errors.