Skip to main content
SingaporeComputer ScienceSyllabus dot point

How do computers store fractional and very large numbers, and why is floating-point arithmetic only approximate?

Explain floating-point representation in terms of sign, mantissa and exponent, and discuss precision, range and rounding error

A focused answer to the H2 Computing outcome on floating point. The sign, mantissa and exponent fields, normalisation, the trade-off between precision and range, and why rounding errors arise.

Generated by Claude Opus 4.88 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Examples in context
  4. Try this

What this dot point is asking

SEAB wants you to explain how a fractional or very large number is stored as a sign, a mantissa and an exponent, what normalising the mantissa achieves, and why floating point trades precision against range and inevitably introduces rounding error. The core idea mirrors scientific notation: store the significant digits separately from a scale factor.

The answer

The three fields

A floating-point number splits a fixed number of bits into three parts:

  • Sign - one bit, 0 for positive and 1 for negative.
  • Mantissa (significand) - the significant binary digits of the value, stored as a fraction.
  • Exponent - a signed power of two that scales the mantissa, deciding where the binary point falls.

The value is, in effect:

value=(1)sign×mantissa×2exponent\text{value} = (-1)^{\text{sign}} \times \text{mantissa} \times 2^{\text{exponent}}

This is binary scientific notation: the mantissa carries accuracy, the exponent carries magnitude.

Normalisation

A value can be written many ways - 0.011×220.011 \times 2^2 equals 0.11×210.11 \times 2^1. Normalising fixes a single convention, typically shifting the mantissa so the first significant bit sits immediately after the binary point and adjusting the exponent to match. This gives a unique representation and spends every mantissa bit on real precision rather than leading zeros.

Precision versus range

The split of bits is a fixed budget:

  • More mantissa bits give more significant figures, so finer precision.
  • More exponent bits give a larger spread of magnitudes, so wider range.

You cannot increase both within a fixed width; moving bits one way costs the other. This is the central design trade-off of any floating-point format.

Why rounding error is unavoidable

Most denary fractions are recurring in binary. For example 0.110=0.000110011001120.1_{10} = 0.0001100110011\ldots_2 repeats forever. With only a finite mantissa, the pattern is truncated or rounded, so the stored value is close but not exact. These tiny errors accumulate over many operations.

Examples in context

Example 1. Scientific computing. A physics simulation may need to represent both atomic distances and astronomical ones. A wide exponent lets a single format span those magnitudes, while the mantissa keeps each value accurate to several significant figures - exactly the range-versus-precision balance the format designers chose.

Example 2. Financial software avoids floats. Because 0.10+0.200.10 + 0.20 does not give exactly 0.300.30 in binary floating point, banking systems store money as integer cents (or use a fixed-point or decimal type). This sidesteps accumulated rounding error that would otherwise leave accounts off by a fraction of a cent.

Try this

Q1. State the role of the exponent field in a floating-point number. [1 mark]

  • Cue. It scales the mantissa by a power of two, setting the magnitude and the position of the binary point.

Q2. Explain what normalising a mantissa achieves. [2 marks]

  • Cue. It removes leading zeros to give a unique representation and uses all mantissa bits for significant figures, maximising precision.

Q3. A format gains two extra exponent bits taken from the mantissa. State the effect on range and precision. [2 marks]

  • Cue. Range increases (larger magnitudes representable) but precision falls (fewer significant bits in the mantissa).

Exam-style practice questions

Practice questions written in the style of SEAB exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Original5 marksA floating-point format uses 1 sign bit, a 5-bit exponent and a 6-bit normalised mantissa. (a) Explain the purpose of each of the three fields. (b) Describe what normalising the mantissa achieves. (c) State the trade-off if more bits are moved from the mantissa to the exponent.
Show worked answer →

(a) The sign bit gives the number's sign (0 positive, 1 negative). The mantissa (also called the significand) holds the significant digits of the value as a binary fraction. The exponent scales the mantissa by a power of two, fixing where the binary point sits.

(b) Normalising shifts the mantissa so that there is a single leading non-zero digit just before (or just after, depending on convention) the binary point, and adjusts the exponent to compensate. This gives every value a unique representation and uses every mantissa bit for precision rather than wasting them on leading zeros.

(c) Moving bits from the mantissa to the exponent increases the range of magnitudes that can be represented but reduces precision, because fewer significant bits remain. It is a direct trade-off between how large and how accurate the numbers can be.

Markers reward a correct role for each field, that normalisation removes leading zeros and gives a unique form, and the explicit range-versus-precision trade-off.

Original4 marksExplain why the denary value 0.10.1 cannot be stored exactly in a binary floating-point number, and describe one consequence this has for a program that adds many such values.
Show worked answer →

In binary, 0.10.1 is a recurring fraction: 0.110=0.000110011001120.1_{10} = 0.0001100110011\ldots_2, repeating forever, just as one third recurs in denary. A floating-point mantissa has only a fixed number of bits, so the recurring pattern must be truncated or rounded, leaving a stored value slightly different from 0.10.1.

A consequence is accumulated rounding error. If a program adds 0.10.1 ten thousand times, each addition carries a tiny error and the errors build up, so the total may be visibly different from the expected 10001000. This is why money is often stored in integer cents and why equality tests on floating-point results should use a tolerance rather than exact comparison.

Markers reward the recurring-binary-fraction explanation, that a finite mantissa forces rounding, and a sensible consequence such as accumulated error or unreliable equality tests.

Related dot points