Absolute and Relative Error by Example

Absolute error measures the size of a difference in the original unit. Relative error compares that difference to the magnitude of a nonzero reference.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Work two scales
  2. Handle a zero reference
  3. Calculate two error measures for the same approximation
  4. State how near-zero cases are judged

Work two scales

An approximation of 99 for a reference of 100 has absolute error one and relative error 0.01. An error of one against reference two is 0.5. Units and scales explain why those quantities convey different information.

Handle a zero reference

Relative error with reference zero has no finite ratio defined by that formula. A tolerance can instead include an absolute part. See floating-point comparison rules.[1][2]

Calculate two error measures for the same approximation

Suppose the exact length is 80 units and the approximation is 78. The absolute error is two units. Relative to the exact value the error is \(2/80=0.025\), or 2.5 percent. If the exact length were eight and the same absolute error occurred, the relative error would be 25 percent. See numerical test tolerances.

Exact       Approximate   Absolute error   Relative error
80          78            2                .025
8           6             2                .25
0           2             2                undefined by division

State how near-zero cases are judged

A relative criterion is unsuitable at an exact zero unless defined with a fallback. A test can use an absolute scale tied to meaningful measurement resolution. Always state the denominator convention.

References

  1. Tobin A. Driscoll and Richard J. Braun, Fundamentals of Numerical Computation ↩
  2. Nicholas J. Higham, Accuracy and Stability of Numerical Algorithms ↩