This is the mail archive of the
`gcc-patches@gcc.gnu.org`
mailing list for the GCC project.

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

*From*: Roger Sayle <roger at eyesopen dot com>
*To*: Bradley Lucier <lucier at math dot purdue dot edu>
*Cc*: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>, <gcc-patches at gcc dot gnu dot org>
*Date*: Sat, 28 Oct 2006 18:11:13 -0600 (MDT)
*Subject*: Re: [PATCH]: PR29335 use MPFR for two-argument math builtins (pow, atan2, hypot)

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
--