Skip to topic
    ← Back to course topics

    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

    1. 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
    1. 1Day 1-2: Review conversion between denary fractional values and both fixed-point and floating-point binary formats.
    2. 2Day 3-4: Practise calculating absolute error for various bit-length constraints, ensuring work is always stated as an unsigned magnitude.
    3. 3Day 5-6: Master relative error calculations and percentage conversions, focusing on dividing by the original true denary value.
    4. 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)
    Calculate

    Show all intermediate mathematical working, including formula substitution, and state the final numerical value with correct precision or percentage formatting.

    Explain

    Provide a reasoned account showing how or why representation limits cause errors, linking finite bit patterns directly to recurring binary fractions.

    Compare

    Identify similarities and differences between absolute and relative error metrics, specifically noting how value magnitude influences relative error.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing the denominator when calculating relative error by dividing by the approximated value instead of the true value.
    ❌ Weak Answer (Loses Marks):Relative error is calculated by doing 0.05 / 4.25 because 4.25 is the computer number.
    Example improved answer:Relative error = |Actual Value - Stored Value| / Actual Value. If the true value is 4.3 and the represented value is 4.25, the calculation is |4.3 - 4.25| / 4.3 = 0.05 / 4.3 = 0.0116 or 1.16%.
    Examiner Tip: Always write down the formula with explicit labels: Relative Error = Absolute Error / Actual Value, before substituting numbers.
    Pitfall: Expressing absolute error as a negative number or omitting units when comparing binary representation errors.
    ❌ Weak Answer (Loses Marks):The absolute error is -0.125.
    Example improved answer:The absolute error is the magnitude of the difference: |4.5 - 4.625| = 0.125 (or 1/8). Absolute error is an unsigned magnitude.
    Examiner Tip: Use vertical modulus bars |Actual - Stored| in your working to remind yourself that absolute error must always be non-negative.
    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. 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. 2.Step 2: Calculate absolute error: |Actual Value - Represented Value| = |13.6 - 13.5625| = 0.0375.
    3. 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).
    Final Answer: Represented value: 13.5625 (1101.1001_2); Absolute error: 0.0375; Relative error: 0.276% (or 0.00276).

    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. 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. 2.Step 2: Compute absolute error: |Actual - Stored| = |0.2 - 0.1875| = 0.0125.
    3. 3.Step 3: Compute relative error percentage: (Absolute Error / Actual Value) * 100 = (0.0125 / 0.2) * 100 = 6.25%.
    Final Answer: Absolute error: 0.0125; Relative error: 6.25%.
    Active Recall Memory Test
    What is the formula for calculating absolute error?
    Key Fact: Absolute Error = |Actual Value - Stored/Approximated Value|
    What is the formula for calculating relative error?
    Key Fact: Relative Error = Absolute Error / Actual Value (or expressed as a percentage by multiplying by 100)
    Why does representing 0.1 in standard IEEE binary floating-point cause an absolute error?
    Key Fact: 0.1 in denary produces a recurring binary fraction (0.000110011...) which cannot be stored exactly in a finite bit length.
    If a measurement of 100 has an absolute error of 1, and a measurement of 10 has an absolute error of 1, which has the larger relative error?
    Key Fact: The measurement of 10, because its relative error is 1/10 (10%), compared to 1/100 (1%) for the measurement of 100.
    Frequently Asked Questions
    Why do computers have errors when storing simple numbers like 0.1?
    Binary systems represent numbers using negative powers of two (1/2, 1/4, 1/8, etc.). A denary fraction can only be represented exactly if its denominator in simplest form is a power of two. Because the denary value 0.1 equals 1/10, its denominator contains the prime factor 5, causing it to become an infinitely repeating binary pattern that must be truncated to fit into a finite mantissa.
    Can absolute error be negative in an A-Level Computer Science exam?
    No. Absolute error represents the magnitude of the difference between the actual value and the approximated value, meaning it is strictly non-negative. You should always apply the absolute value operation |Actual - Approximated| to ensure your result is positive or zero.
    When should I convert relative error into a percentage?
    You can leave relative error as a decimal or fraction unless the exam question explicitly asks for 'percentage relative error'. If it asks for percentage error, multiply your relative error fraction by 100 and include the '%' symbol.
    Why is relative error considered more useful than absolute error?
    Relative error contextualises the mistake against the scale of the value being measured. An absolute error of 1 cm is negligible when measuring a bridge of 100 metres (0.001% relative error), but catastrophic when machining a precision component of 2 cm (50% relative error). It gives an objective sense of accuracy across different orders of magnitude.
    How does normalisation in floating-point binary help reduce relative error?
    Normalisation ensures that the most significant non-zero bit immediately follows the binary point. This ensures that no mantissa bits are wasted on leading zeroes, providing the maximum possible number of significant bits for the fraction and minimising the relative representation error for any given magnitude.