Relative error (source code)

= Relative error
{title2=$|x_{\mathrm{approx}}-x|/|x|$}

For a nonzero reference value $x$, the relative error is the <absolute error> divided by the reference's <absolute value>:
$$
\frac{|x_{\mathrm{approx}}-x|}{|x|}.
$$
It is <dimensionless> and expresses the size of the error compared with the quantity being approximated. Approximating $1/3$ by $0.33$ has <absolute error> $1/300$ and <relative error> $1/100=1\%$. The definition is unavailable when the reference is zero; use an <absolute error> or a separately stated scale in that case.