Why is computation of this function numerically unstable?
The question has been changed since this answer.



Another alternative is
$$\begin{align}f(x)&amp;=\frac{\sqrt{x+h}-\sqrt{x-h}}{2h}\\
&amp;=\frac{\sqrt{x+h}-\sqrt{x-h}}{2h}\cdot\frac{\sqrt{x+h}+\sqrt{x-h}}{\sqrt{x+h}+\sqrt{x-h}}\\
&amp;=\frac{1}{\sqrt{x+h}+\sqrt{x-h}}\end{align}$$

Now, even if $h$ becomes very small, the value approaches $$\frac{1}{2\sqrt{x}}$$ as it should.