Almost every number a computer produces is an approximation: a rounded constant, a truncated series, the last step of an iteration. Before we can compare methods we need a precise way to say how good an approximation is. You met the idea as Percent Error; here we sharpen it and connect it to scientific notation and significant digits.
Let $x$ be the true value and $\tilde{x}$ an approximation of it. The absolute error is $$|\tilde{x} - x|,$$ and, when $x \ne 0$, the relative error is $$\frac{|\tilde{x} - x|}{|x|}.$$ The absolute error carries the units of $x$. The relative error has no units; multiplied by 100 it is the percent error.
Key idea
Why it works
Worked example: Both errors
- Absolute error: $|248 - 250| = 2$ L.
- Relative error: $\frac{2}{250} = 0.008$, or $0.8\%$.
- Divide by the true value, $250$, not by the reading.
Answer: $2$ L and $0.008$
Worked example: Comparing approximations of different sizes
- Absolute errors: $|3.14 - \pi| \approx 0.00159$ and $400$ km. The second looks enormous.
- Relative errors: $\frac{0.00159}{3.14159} \approx 5.1 \times 10^{-4}$ and $\frac{400}{384{,}400} \approx 1.0 \times 10^{-3}$.
- Measured relative to their size, $3.14$ is about twice as good, though both are right to about 3 significant digits.
Answer: $3.14$ for $\pi$
A common way to make "correct digits" exact: $\tilde{x}$ approximates $x$ to $t$ significant digits when $t$ is the largest whole number with $$\frac{|\tilde{x} - x|}{|x|} \le 5 \times 10^{-t}.$$
Worked example: Counting significant digits
- Absolute error: $|2.718 - 2.71828183| = 0.00028183$.
- Relative error: $0.00028183 \div 2.71828183 \approx 1.04 \times 10^{-4}$.
- It is at most $5 \times 10^{-4}$ but more than $5 \times 10^{-5}$, so $t = 4$, matching the 4 digits written.
Answer: $4$
Common mistake