Cancellation error (source code)

= Cancellation error

Subtracting nearly equal approximate quantities can lose significant digits because the absolute input errors become large relative to the small difference. For example, the positive <polynomial root> of $az^2+z-y=0$ can be evaluated as $2y/(1+\sqrt{1+4ay})$, avoiding the subtraction in $(-1+\sqrt{1+4ay})/(2a)$ when $ay$ is small.