Skip to content

Edvfrance

Actu

Relative Gap: How to Calculate It and What It Means in Everyday Life

Relative difference expresses the difference between two values as a fraction or percentage. This measure is widely used in science, finance and…

Femme analyste financière étudiant des tableaux de données avec des écarts relatifs dans un bureau moderne

Relative error expresses the difference between two values as a fraction or percentage. This measure, widely used in science, finance, and quality control, is based on a simple calculation: divide the absolute difference by a reference value. The result changes dramatically depending on the denominator chosen, which creates a practical problem whenever the reference is unclear or close to zero.

Relative error and absolute error: how the denominator changes things

Criterion Absolute error Relative error
Formula |Measured value – Reference value| |Measured value – Reference value| / Reference value
Unit Same unit as the quantity (kg, €, mm) Unitless (often expressed as a %)
Scale sensitivity None: a 5 kg difference is still 5 kg High: 5 kg out of 10 kg = 50%, 5 kg out of 1,000 kg = 0.5%
Limitation Says nothing about proportion Becomes uninformative if the reference is close to zero

Absolute error gives the raw size of a difference. Relative error puts it in context by comparing it with an order of magnitude, making it possible to compare situations at different scales.

A €2 difference on a €3 coffee and a €2 difference on monthly rent do not carry the same weight. Relative error conveys this proportion, whereas absolute error does not.

To understand relative error, you first need to accept that the result depends entirely on the choice of value in the denominator. That choice is not always neutral.

Man comparing two products in a supermarket to assess a relative price difference

Reference close to zero: when relative error loses its meaning

The formula divides by the reference value. As that value approaches zero, the ratio skyrockets. A temperature that rises from 0.1 °C to 0.3 °C has a relative error of 200%, even though the absolute difference is only 0.2 °C.

A dramatic relative error does not mean the difference is significant. In its documentation on percentage error, NIST explicitly notes that the ratio is undefined when the reference is zero and becomes misleading for values close to zero.

There are three effective strategies for handling this situation:

  • Use absolute error when it is sufficient to describe the situation (a 0.2 °C change remains negligible in most industrial contexts).
  • Compare the difference with the mean of the two values rather than with either one, to avoid treating a near-zero number as a benchmark.
  • Set a minimum absolute threshold below which the percentage is not calculated, as Python’s math.isclose function does by combining relative and absolute tolerances.

What these three approaches have in common is that they make the chosen denominator and threshold explicit before displaying a percentage.

Comparing two values without a reference: relative difference or relative error

Relative error assumes that one of the two values is the reference—the “true” value. In metrology, this is often the theoretical value, a standard, or a reference standard. In that case, the calculation is unambiguous.

Things get more complicated when two measurements are available and neither qualifies as the reference. Comparing prices from two suppliers, returns on two investments, or travel times for two routes does not establish an absolute truth. Using “relative difference” rather than “relative error” avoids biasing the analysis by implicitly treating one of the two numbers as the benchmark.

The choice of denominator can then significantly change the result. If one quote is €8,000 and another is €10,000, dividing the difference by the first gives 25%, while dividing it by the second gives 20%. Neither percentage is wrong, but they tell different stories.

Common convention: divide by the larger absolute value

When there is no industry-specific convention, dividing the difference by the larger of the two values in absolute terms produces a more conservative percentage. This is the principle used by Python’s relative comparison. This convention has one advantage: the result never exceeds 100%, making it easy to interpret.

Young woman calculating relative differences by hand in a notebook at home

Relative error in numerical computing: the conditioning trap

One area where relative error takes on critical importance is numerical computing. Two input datasets may appear almost identical (with a tiny relative difference) yet produce very different results after processing. This phenomenon, known as conditioning, measures how sensitive a mathematical problem is to small perturbations in its inputs.

An ill-conditioned problem amplifies relative differences. The final result then shows a divergence disproportionate to the precision of the initial data. A small relative difference in the input does not guarantee a small difference in the output.

This concept extends beyond academia. In a financial spreadsheet, subtracting two large, similar numbers can produce a result whose decimal places are unreliable. The relative error in the result increases, not because the data is poor, but because the operation is inherently sensitive.

Measurement uncertainty and relative error: two distinct concepts

Calculating relative error between a measurement and a reference gives a percentage error. This assumes that the reference is exact. In practice, the reference value itself carries uncertainty.

In Technical Note 1297, NIST clearly distinguishes error (comparison with a value considered true) from uncertainty (the doubt associated with a result). Reporting a relative error of 0.3% without mentioning that the measurement uncertainty is 0.5% amounts to claiming fictitious precision.

Combining relative uncertainties follows specific rules. The GUM (Guide to the expression of uncertainty in measurement, JCGM 100:2008) prescribes a root-sum-of-squares method for independent measurements. If the measurements are correlated, covariance terms are added. Simply adding uncertainty percentages overestimates or underestimates the result.

Relative error remains a powerful comparison tool, provided it is not reduced to a mechanical division. The choice of denominator, proximity to zero, and uncertainty associated with each measurement determine whether the resulting percentage informs or misleads. Stating the calculation method used—especially when neither value serves as an indisputable reference—turns a raw figure into useful information.

Relative Gap: How to Calculate It and What It Means in Everyday Life