Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> No. If x is 1e8 * y, then y will only affect the result in the 16th
> place. You can see this if you do a simple series expansion:
> sqrt(1+yx^2) = 1 + 1/2 yx^2 + O(yx^4)
Sigh, I went looking for that expansion yesterday and didn't find it.
Should've tried harder. I was relying on a gut feeling that it would
behave approximately like ln(1+x).
> For most cases, the new algorithm is no more accurate than the old
> one. The exception is when *both* x and y are very small. In this
> case, it protects against incorrect underflows to 0.
Yeah, I think you're right.
regards, tom lane