On 12/5/06, Joseph S. Myers <[EMAIL PROTECTED]> wrote:
On Tue, 5 Dec 2006, Richard Guenther wrote:
> is whether a correctly rounded "exact" cbrt differs from the pow
> replacement by more than 1ulp - it looks like this is not the case.
They fairly obviously differ for negative arguments, which are valid for
cbrt but not for pow (raising to a fraction with even denominator). (The
optimization from pow to cbrt is valid if you don't care about no longer
getting a NaN from a negative argument. Converting the other way (cbrt to
pow) is only OK if you don't care about negative arguments to cbrt at
all.)
True, F.9.4.4 says "pow (x, y) returns a NaN and raises the invalid
floating-point
exception for finite x < 0 and finite non-integer y. I'll adjust the expander
to cover these cases by conditionalizing on tree_nonnegative_p or
HONOR_NANS. I will probably also require flag_unsafe_math_optimizations
as we else will optimize cbrt (x) - pow (x, 1./3.) to zero. Or even
pow (x, 1./3.) - pow (x, nextafter (1./3, 1)).
Richard.