That’s actually what I want. I’m evaluating relative error
\textrm{err}(u, v) = \frac{\displaystyle u - v}{\displaystyle 0.5 \cdot (|u| + |v|)}.
If x = 10^{10}, I want different error than x = 10^{-10}.
Thanks! They need to consolidate the Wikipedia pages around this!
I found the finite difference page approximation page, which as a finite difference derivative approximation section that doesn’t link to the page @anon75146577 found.
The simple recommendation is to evaluate f(x) and f(x + h) with h = \sqrt{\epsilon} \, x, where \epsilon is the machine precision, whihc is roughly \epsilon \approx 10^{-16} for double-precision, so \sqrt \epsilon \approx 10^{-8}. The more complex technique uses second derivatives to choose a better h, but I don’t think we need to be that extreme.
Obviously, this won’t work when x = 0, hence my question 3.