Absolute, relative, truncation, and data error
Objective: Can relative error be used unchanged when the exact answer is zero?
Every computation begins with an exact target and an approximation; different error measures answer different questions and must not be interchanged without scale information.
Read the target and error measure before running the algorithm: For exact x and approximation x̂, absolute error is |x−x̂| and relative error is |x−x̂|/|x| when x≠0; truncation error comes from replacing an infinite process, while data error is already present in the input. The guarantee to establish is: If |x−x̂|≤ε and |x|≥m>0, then relative error is at most ε/m; without a lower bound on |x| no such conversion is possible. Keep the data scale, norm, precision, stopping rule, and discretization attached to every reported digit.
The worked question is: Approximate √2 by 1.414 and compute absolute and relative error. Start from “Use √2≈1.414213562 and subtract 1.414.” and finish at “Divide by √2 to obtain relative error about 1.51×10⁻⁴.” Then use the stated residual, bound, invariant, or refinement comparison to decide what the digits actually certify.
If |x−x̂|≤ε and |x|≥m>0, then relative error is at most ε/m; without a lower bound on |x| no such conversion is possible.
Start from |x−x̂|≤ε and divide by the known positive quantity |x|.
Use |x|≥m to obtain 1/|x|≤1/m.
Combine the inequalities to get |x−x̂|/|x|≤ε/m.
Approximate √2 by 1.414 and compute absolute and relative error.
- Use √2≈1.414213562 and subtract 1.414.
- The absolute error is approximately 0.000213562.
- Divide by √2 to obtain relative error about 1.51×10⁻⁴.
Result: The absolute error is about 2.14×10⁻⁴ and the relative error about 0.0151%; the reference value itself is rounded, so the displayed last digits are approximate.