Skip to content

Rounding Error and Total Error

Reducing the step size hh decreases the truncation error, but there is a lower limit. When hh becomes very small, a different source of error dominates: rounding error (also known as loss of significance). Understanding how both errors combine reveals why there is an optimal step size that minimises the total error.


Why Small hh Amplifies Rounding Error

When hh is very small, the values f(x+h)f(x+h) and f(x−h)f(x-h) become nearly identical. For example, if h=0.001h = 0.001:

f(2+0.001)≈f(2−0.001)f(2 + 0.001) \approx f(2 - 0.001)

Subtracting two numbers that are almost equal causes catastrophic cancellation: the significant digits cancel out, leaving only the rounding noise in the least significant bits. This noise is then divided by the tiny value 2h2h, which amplifies the error severely.


The Floating-Point Error Model

Based on the floating-point representation fl(x)=(1+δ)xfl(x) = (1 + \delta)x (where δ\delta is the relative rounding error), evaluating the function at the shifted points introduces small multiplicative errors:

fl[f(x+h)]=(1+δ1) f(x+h)fl[f(x+h)] = (1 + \delta_1)\,f(x+h)

fl[f(x−h)]=(1+δ2) f(x−h)fl[f(x-h)] = (1 + \delta_2)\,f(x-h)

where ∣δ1∣, ∣δ2∣≤εM|\delta_1|,\, |\delta_2| \leq \varepsilon_M and εM\varepsilon_M is the machine epsilon: the upper bound on the relative rounding error for the floating-point system in use.


Total Error Formula

The total error in the central difference approximation is the sum of the truncation error and the rounding error:

Total Error  ≤  ∣f′′′(ξ) h26∣+εM ∣f(x+h)∣+∣f(x−h)∣2h\text{Total Error} \;\leq\; \left|\frac{f'''(\xi)\,h^2}{6}\right| + \varepsilon_M \,\frac{|f(x+h)| + |f(x-h)|}{2h}

ComponentScales with hhBehaviour as h→0h \to 0
Truncation errorproportional to h2h^2Decreases toward zero
Rounding errorproportional to 1/h1/hIncreases without bound

The Optimal Step Size

Because the two error components move in opposite directions as hh changes, the total error graph forms a distinct V-shaped (or U-shaped) curve when plotted on a logarithmic scale.

Log-log graph showing truncation error decreasing with smaller h, rounding error increasing, and total error forming a minimum at the optimal h.
  • For large hh (right side): Truncation error dominates, and the total error is large.
  • For small hh (left side): Rounding error from catastrophic cancellation dominates, and the total error shoots back up.
  • At the minimum of the curve: An optimal hh exists where the two contributions are perfectly balanced, yielding the lowest possible total error.