On Dec 4, 2006, at 6:08 PM, Richard Guenther wrote:
The question
is whether a correctly rounded "exact" cbrt differs from the pow
replacement by more than 1ulp - it looks like this is not the case.
If that is the question, I'm afraid your answer is not accurate. In
the example I showed the difference is 2 ulp. The difference appears
to grow with the magnitude of the argument. On my systems, when the
argument is DBL_MAX, the difference is 75 ulp.
pow(DBL_MAX, 1./3.) = 0x1.428a2f98d7240p+341
cbrt(DBL_MAX) = 0x1.428a2f98d728bp+341
And yes, I agree with you about the C99 standard. It allows the
vendor to compute pretty much any answer it wants from either pow or
cbrt. Accuracy is not mandated. And I'm not trying to mandate
accuracy for Gfortran either. I just had a knee jerk reaction when I
read that pow(x, 1./3.) could be optimized to cbrt(x) (and on re-
reading, perhaps I inferred too much right there). This isn't just
an optimization. It is also an approximation. Perhaps that is
acceptable. I'm only highlighting the fact in case it might be
important but not recognized.
-Howard