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,i386]: Implement hypot{,f,l} functions as built-in x87intrinsics

On Mon, 14 Feb 2005, Richard Henderson wrote:
> On Sat, Feb 12, 2005 at 01:34:17PM +0100, Uros Bizjak wrote:
> > This patch implements hypot{f,l} functions as built-in x87 intrinsics.
> > Patch is bootstrapped on pentium4-pc-linux-gnu, regtested for c and c++.
> I don't see why you're doing this one specific to x86.  Any target
> that supports sqrt should handle it just the same, surely?

I believe the hypot function is intended to be used in situations
where x*x, y*y or x*x+y*y may potentially overflow/underflow, i.e.
it's supposed to be more accurate than sqrt(x*x+y*y).

This is one of those rare cases where x87's extended precision is
actually a help, as x*x + y*y can be safely calculated in 80-bit
XFmode precision without problems.  Most other glibc targets needs
to mess around with argument reduction in their hypot implementations.

Of course, with -ffast-math, hypot(x,y) is reasonably implemented
as sqrt(x*x+y*y) on all platforms.


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