Intermediate

Representation Errors and Precision

AicademyAicademy
·A-Level Computer Science·AQA 7517·6 min
4.5.4.5 Rounding errors·4.5.4.6 Absolute and relative errors·4.5.4.7 Range and precision·4.5.4.9 Underflow and overflow

Rounding Errors

Not every real number can be represented exactly in binary with a finite number of bits. When a value cannot be stored exactly, it is rounded to the nearest representable value — introducing a rounding error.

Classic example: in binary.

Converting 0.1 by repeated multiplication by 2:

StepValueBit
0
0
0
1
1
0 (repeats)

— a repeating binary fraction, similar to in decimal.

No finite number of bits can represent 0.1 exactly. Any floating-point or fixed-point system that stores a finite number of bits must approximate it.

Consequence: rounding errors accumulate in repeated calculations. Adding ten times in floating point may not give exactly .

Absolute and Relative Errors

Absolute error is the magnitude of the difference between the true value and the stored approximation:

Relative error expresses the error as a proportion of the true value:

Worked examples:

Example 1 — true value = 1000, stored value = 999:

  • Absolute error =
  • Relative error = (0.1%)

Example 2 — true value = 0.01, stored value = 0.009:

  • Absolute error =
  • Relative error = (10%)

Key insight: the same absolute error has a much larger relative impact for small numbers. A error in a value of is trivial; a error in a value of 5 is a 20% error.

Floating-point arithmetic maintains roughly constant relative error (errors scale with magnitude), while fixed-point arithmetic maintains constant absolute error.

Range and Precision

Precision is the smallest difference between two representable values — how finely spaced the representable numbers are.

Range is the span from the most negative to the most positive representable value.

For any fixed total bit count, precision and range trade off against each other:

  • More bits allocated to the mantissa → finer precision, same range
  • More bits allocated to the exponent → larger range, coarser precision

Fixed point:

  • Constant absolute precision (spacing between adjacent values is always )
  • Limited range: determined by the number of integer bits
  • Best for: financial calculations, sensor readings — any context where the value range is known and bounded

Floating point:

  • Variable absolute precision: precision decreases for very large numbers (the representable values become further apart)
  • Large range: controlled by the exponent
  • Best for: scientific computing, graphics, physics simulations — anywhere values span many orders of magnitude

Example — with 4 fractional bits, fixed point: Adjacent values differ by . The precision near 1000 and near 0.001 is the same absolute amount: 0.0625. Relative precision near 0.001 is poor: .

Overflow and Underflow

Overflow occurs when a calculation produces a result whose magnitude is too large to represent in the available bits.

  • In unsigned binary: result exceeds . The carry out of the MSB is lost; the result wraps around.
  • In floating-point: the exponent exceeds its maximum representable value.

Example — 8-bit unsigned overflow: . But , so the result wraps: .

  1100 1000   (200)
+ 0110 0100   (100)
-----------
1 0010 1100   → carry out discarded → 0010 1100 = 44 (incorrect)

Underflow occurs when the result of a floating-point calculation is too small in magnitude to represent — its absolute value is smaller than the smallest non-zero representable value. The result rounds to zero.

  • This commonly occurs when two very small numbers are multiplied together.
  • Underflow in floating point: the exponent drops below its minimum representable value.
ConditionWhat happensEffect
Integer overflowMSB carry lost; wraps aroundSilent incorrect result
Float overflowExponent too largeResult is incorrect (behaviour is implementation-defined)
Float underflowExponent too smallResult rounds to zero

Studying this for an exam?

Generate a personalised learning path for this subject. Free to get started.

Create a learning path

Fixed Point vs Floating Point: Comparison

Fixed pointFloating point
PrecisionConstant absoluteConstant relative (proportional to magnitude)
RangeLimited by integer bitsLarge (controlled by exponent)
Rounding errorsPresent near limits of precisionPresent throughout; worse near zero
OverflowAt range boundaryWhen exponent overflows
UnderflowNot applicableWhen exponent underflows (rounds to zero)
SpeedFaster — simpler hardwareSlower — complex arithmetic unit
Use casesFinance, embedded systemsScience, graphics, general purpose

In practice: modern hardware implements IEEE 754 floating-point arithmetic in dedicated FPUs (floating-point units). Fixed-point arithmetic is used in embedded systems (microcontrollers without FPUs) and financial systems (where exact decimal representations are legally required).

Common Exam Mistakes

1. Claiming floating point has more precision than fixed point

Floating point has greater range but not necessarily greater precision. For numbers close to zero, floating point can represent very small values; for large numbers, the representable values become more widely spaced, reducing absolute precision.

2. Confusing absolute and relative error

Absolute error has the same units as the value. Relative error is dimensionless (a ratio). A question asking for "relative error" expects a ratio or percentage, not the raw difference.

3. Thinking overflow always produces an error message

In many hardware and language contexts, integer overflow silently wraps around (produces an incorrect result without any warning). Floating-point overflow may produce a special value like infinity rather than raising an exception.

4. Confusing underflow with a small number being stored correctly

Underflow is a specific condition where the result rounds to zero because it is smaller than the smallest representable non-zero value. A small but representable non-zero number is not underflow.

Generate revision on any topic you study

Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set — personalised to your level.

Lessons on anything

Structured, level-matched lessons on any topic you study

Practice quizzes

Find out what you actually know before the exam does

Flashcard sets

Lock in key concepts with instant revision cards

Ask Aica

Stuck on something? Get a clear explanation, any time

Prev

Floating Point Numbers

Next

Character Encoding and Error Detection

Related lessons

7 Slides

Lesson

Floating Point Numbers

A-Level Computer Science · AQA 7517

10 hours ago

7 Slides

Lesson

Binary Number Representations

A-Level Computer Science · AQA 7517

10 hours ago