Error and Representation
Absolute and Relative Error
Given a true value and an approximation, compute the absolute error |true-approx|, the relative error |abs_err/true|, and the percentage error (relative×100). Example: true=22/7, approx=3 gives abs_err=1/7≈0.142857, rel_err=1/22≈0.045455, pct_err=50/11≈4.545455%.
Example
absolute-relative-error
The absolute error measures the magnitude of the difference between the true and approximate values: abs_err = |true - approx| The relative error normalises by the true value: rel_err = abs_err / |true| Percentage error multiplies relative error by 100.