Absolute and relative errors — AQA A-Level Computer Science
Absolute error is the numerical difference between an actual value and its represented floating-point value, while relative error expresses this difference as a ratio or percentage of the true value. Understanding both error metrics is crucial in AQA A-Level Computer Science for evaluating precision loss, rounding artefacts, and representation limits in fixed-point and floating-point binary systems.
Absolute and relative errors explained
Absolute error measures how far a stored or computed value differs from the true value, expressed in the same units as the data.
Read the full explanation
It is calculated as the magnitude of the difference: absolute error = |true value − approximate value|. The vertical bars mean the result is always non-negative, because the direction of the difference does not matter when you are measuring its size. For example, if a real number such as 0.1 is stored in a binary floating-point format and read back as 0.100000001490116, the true value is 0.1 and the approximate value is 0.100000001490116, so the absolute error is |0.1 − 0.100000001490116| = 0.000000001490116. Compare the answer with the true value to judge whether the error is significant. Absolute error alone does not tell you how serious an error is relative to the size of the number, which is why relative error is studied alongside it.
Your focus
- Be able to calculate the absolute error of numerical data stored and processed in computer systems.
Which command word is this?
Show all intermediate mathematical working, including formula substitution, and state the final numerical value with correct precision or percentage formatting.
Absolute and relative errors exam tips
Topic Overview
In AQA A-Level Computer Science, real numbers are represented in binary using either fixed-point or floating-point notation. Because computers allocate a finite number of bits to mantissas and fractional parts, many rational and irrational base-10 numbers cannot be represented precisely, causing quantisation and rounding errors.
Absolute and relative errors are standard metrics used to quantify these precision losses. Absolute error indicates the raw numerical magnitude of the discrepancy, whereas relative error contextualises that error against the magnitude of the original number, enabling software engineers to assess numerical stability and avoid critical calculation failures.
Key Concepts
- →Absolute Error formula: Absolute Error = |True Value - Approximated Value|.
- →Relative Error formula: Relative Error = Absolute Error / True Value (often multiplied by 100 for percentage error).
- →Effect of Magnitude: A constant absolute error produces a significantly higher relative error for small numbers than for large numbers.
- →Binary Limitations: Denary fractions whose denominators have prime factors other than 2 (such as 0.1 or 0.2, which have a factor of 5) produce recurring binary fractions and cannot be represented exactly.
- →Trade-offs in Normalisation: Floating-point normalisation maximises the number of significant bits in the mantissa, thereby minimising relative error across varying magnitudes.
Marking Points
- Identifies the true value and the approximate (stored or computed) value before subtracting
- Subtracts the approximate value from the true value, or the reverse, and takes the magnitude
- Gives the answer as a non-negative value with the same units as the original data
- Applies the calculation correctly to numbers stored in binary, including fractions that cannot be stored exactly
- States the result with an appropriate number of significant figures or decimal places
Examiner Tips
- 💡Write the formula |true − approximate| before substituting numbers so the method is visible
- 💡Check which value is the true value; the question will usually state it
- 💡Keep enough digits during working so rounding does not change the final answer
- 💡Always state both values clearly (the true denary value and the converted binary value) before undertaking subtraction so examiners can award method marks.
- 💡Unless instructed otherwise, you may leave relative error as a fully simplified fraction or convert it to a percentage rounded to 2 or 3 significant figures.
- 💡Check whether the question specifies two's complement for negative numbers, as this affects the interpretation of sign and magnitude in the mantissa.
Common Mistakes
- Reports a negative absolute error; take the magnitude so the result is non-negative
- Uses the approximate value as the true value, so the error is measured against the wrong reference
- Confuses absolute error with relative error and divides by the true value when only the difference is asked for
- Forgets to include the units of the quantity in the answer
- Believing that all simple terminating decimal numbers terminate in binary. Decimals like 0.1 or 0.2 recur infinitely in base 2, inevitably resulting in a non-zero absolute error in finite binary formats.
- Dividing by the approximated or stored value rather than the theoretical true value when computing relative error.
- Thinking a smaller absolute error always means a better representation, ignoring that relative error gives a much better measure of real-world impact and significance.
Revision Plan
- 1Day 1-2: Review conversion between denary fractional values and both fixed-point and floating-point binary formats.
- 2Day 3-4: Practise calculating absolute error for various bit-length constraints, ensuring work is always stated as an unsigned magnitude.
- 3Day 5-6: Master relative error calculations and percentage conversions, focusing on dividing by the original true denary value.
- 4Day 7: Tackle past-paper questions from AQA Paper 2 covering normalisation, overflow, underflow, and error bounds.
Exam Question Types
- 📋Direct Calculation: Given a real value and a specific bit allocation (e.g. 8-bit fixed point), convert the value and calculate absolute and relative errors.
- 📋Comparative Analysis: Compare the precision and relative error of fixed-point versus floating-point representations for extremely small or extremely large values.
- 📋Scenario/Discussion Questions: Explain why financial or safety-critical software systems experience accumulated rounding errors and how using appropriate error metrics identifies this risk.
Command Word Expectations (AQA)
Show all intermediate mathematical working, including formula substitution, and state the final numerical value with correct precision or percentage formatting.
Provide a reasoned account showing how or why representation limits cause errors, linking finite bit patterns directly to recurring binary fractions.
Identify similarities and differences between absolute and relative error metrics, specifically noting how value magnitude influences relative error.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: A real number with a denary value of 13.6 is represented in an 8-bit fixed-point binary format with 4 bits for the integer part and 4 bits for the fractional part. (a) State the closest binary representation and its denary equivalent. (b) Calculate the absolute error. (c) Calculate the relative error to 3 significant figures.
- 1.Step 1: Determine the binary place values for 4 integer and 4 fractional bits: 8, 4, 2, 1 . 0.5, 0.25, 0.125, 0.0625. The integer part 13 is 1101_2. The fractional part 0.6 is approximated by testing binary fractions: 0.5 (yes, remaining 0.1), 0.25 (no), 0.125 (no), 0.0625 (yes, remaining 0.0375). Binary is 1101.1001_2, which equals 13 + 0.5 + 0.0625 = 13.5625.
- 2.Step 2: Calculate absolute error: |Actual Value - Represented Value| = |13.6 - 13.5625| = 0.0375.
- 3.Step 3: Calculate relative error: Absolute Error / Actual Value = 0.0375 / 13.6 = 0.00275735... Multiply by 100 to express as a percentage: 0.276% (or 0.00276 as a decimal fraction).
Question: A sensor outputs a denary measurement of 0.2. In a simplified 6-bit floating-point system using two's complement with a 4-bit mantissa and a 2-bit exponent, the value is stored as 0.110_2 * 2^(-2). Calculate the absolute error and the percentage relative error.
- 1.Step 1: Convert the stored floating-point value to denary. Mantissa 0.110_2 = 0.5 + 0.25 = 0.75. Exponent is -2 in denary. Stored value = 0.75 * 2^(-2) = 0.75 * 0.25 = 0.1875.
- 2.Step 2: Compute absolute error: |Actual - Stored| = |0.2 - 0.1875| = 0.0125.
- 3.Step 3: Compute relative error percentage: (Absolute Error / Actual Value) * 100 = (0.0125 / 0.2) * 100 = 6.25%.