Skip site navigation (1) Skip section navigation (2)

Re: phypot - Pygmy Hippotause ?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Paul Matthews" <plm(at)netspace(dot)net(dot)au>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: phypot - Pygmy Hippotause ?
Date: 2009-08-28 15:02:01
Message-ID: 4A97AB19020000250002A4EA@gw.wicourts.gov (view raw or flat)
Thread:
Lists: pgsql-hackers
Paul Matthews <plm(at)netspace(dot)net(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Marko TiikkajaDate: 2009-08-28 15:12:30
Subject: UPDATE .. RETURNING OLD.*
Previous:From: Tom LaneDate: 2009-08-28 14:52:16
Subject: Re: [PATCH] Largeobject access controls

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group