This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: PR29335 use MPFR for two-argument math builtins (pow, atan2, hypot)

On Sat, 28 Oct 2006, Roger Sayle wrote:

> On Sat, 28 Oct 2006, Bradley Lucier wrote:
> >  > hypot(x,x) -> x*sqrt(2)
> >
> > I think this can change the value computed in some cases, because
> > there's one rounding error computing sqrt(2) and one more computing
> > the multiplication.
> Grr.  I missed this.  I did give some thought to multiple rounding
> when reviewing the patch, but I made the (obvious in retrospect)
> incorrect assumption that the compile-time constant sqrt(2) wasn't
> rounded, so the perfect rounding of the single multiplication was
> acceptable.  Alas not.
> Kaveh, I'll preapprove the "obvious" simple change to control this
> transformation with flag_unsafe_math_optimizations.
> Many thanks to Brad for catching this.
> Roger

Okay I'll take care of adding this as a follow-up.  Thanks for the review.

Hmm... after some more thought I'm wondering don't I also need a fabs in
there?  I.e.:

hypot(x,x) -> fabs(x)*sqrt(2)

Kaveh R. Ghazi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]