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

Compute absolute error, relative error, and percent error from exact values.

highlighted = computed this step

Step 1 — Set up

Use true value 22 over 7 and approximation 3.

true=227approx=3\text{true}= \frac{22}{7} \quad \text{approx}= 3

Step 2 — Absolute error

Compute absolute error from 3 and 22 over 7 to get 1 over 7.

3227=17| 3 - \frac{22}{7} |= \hlmath{\frac{1}{7}}

Step 3 — Relative error

Divide 1 over 7 by 22 over 7 to get 1 over 22.

17÷227=122\frac{1}{7} \div \frac{22}{7} = \hlmath{\frac{1}{22}}

Step 4 — Percent error

Multiply 1 over 22 by 100 to get 50 over 11 percent.

122×100%=5011%\frac{1}{22} \times 100 \%= \hlmath{\frac{50}{11}} \%
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.