Re: Slaying the HYPOTamus

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Slaying the HYPOTamus
Дата
Msg-id 407d949e0908222139t35ad3ad2q3e6b15646a27dd64@mail.gmail.com
обсуждение исходный текст
Ответ на Slaying the HYPOTamus  (Paul Matthews <plm@netspace.net.au>)
Ответы Re: Slaying the HYPOTamus  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sun, Aug 23, 2009 at 4:54 AM, Paul Matthews<plm@netspace.net.au> wrote:
>
> The hypot() function has been part of the C standard since C99 (ie 10
> years ago)

Postgres targets C89. The date of the standard is when the standard
came out, it takes years before it's widely available and then years
again before the systems with the old compiler are no longer
interesting.

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.

> The function is designed not to fail where the current naive macro would
> result in overflow.

The code seems to be blissfully unaware of overflow dangers :( Even if
hypot() avoids spurious overflows it's always possible for there to be
a legitimate overflow which we ought to detect and handle properly.

-- 
greg
http://mit.edu/~gsstark/resume.pdf


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Paul Matthews
Дата:
Сообщение: Slaying the HYPOTamus
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Slaying the HYPOTamus