Re: phypot - Pygmy Hippotause ?

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: phypot - Pygmy Hippotause ?
Дата
Msg-id 4A97AB19020000250002A4EA@gw.wicourts.gov
обсуждение исходный текст
Ответ на phypot - Pygmy Hippotause ?  (Paul Matthews <plm@netspace.net.au>)
Ответы Re: phypot - Pygmy Hippotause ?  (Paul Matthews <plm@netspace.net.au>)
Список pgsql-hackers
Paul Matthews <plm@netspace.net.au> wrote: 
> Feedback appreciated.
+     /* As x is the larger value, this must be the correct answer.
Also
+      * avoids division by zero. */
+     if( x == 0.0 )
+         return 0.0;
+ 
+     /* Trivial case. */
+     if( y == 0.0 )
+         return x;
The first test seems unnecessary if you have the second.
x >= 0, so x can't be zero unless y is, too.
Returning x on y == 0.0 will return 0.0 whenever x == 0.0.
-Kevin


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Largeobject access controls
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: UPDATE .. RETURNING OLD.*