Re: Slaying the HYPOTamus

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Paul Matthews <plm(at)netspace(dot)net(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Slaying the HYPOTamus
Date: 2009-08-23 09:16:52
Message-ID: 9837222c0908230216o7fe737c4v96ec03f0f91f869b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 23, 2009 at 07:42, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Greg Stark <gsstark(at)mit(dot)edu> writes:
>> If there's a performance advantage then we could add a configure test
>> and define the macro to call hypot(). You said it existed before C99
>> though, how widespread was it? If it's in all the platforms we support
>> it might be reasonable to just go with it.
>
> For one data point, I see hypot() in HPUX 10.20, released circa 1996.
> I suspect we would want a configure test and a substitute function
> anyway.  Personally I wouldn't have a problem with the substitute being
> the naive sqrt(x*x+y*y), particularly if it's replacing existing code
> that overflows in the same places.

For another data point, Microsoft documentation says:
"This POSIX function is deprecated beginning in Visual C++ 2005. Use
the ISO C++ conformant _hypot instead."

_hypot() has been there since Windows 95, so it shouldn't be a problem
to use it - it just needs a define, like we have for some other such
functions.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nicolas Barbier 2009-08-23 10:21:22 Re: Slaying the HYPOTamus
Previous Message Paul Matthews 2009-08-23 07:00:50 Re: Slaying the HYPOTamus