Re: Fixing geometic calculation - Mailing list pgsql-hackers

From Sam Mason
Subject Re: Fixing geometic calculation
Date
Msg-id 20090807185937.GP5407@samason.me.uk
Whole thread Raw
In response to Re: Fixing geometic calculation  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
On Fri, Aug 07, 2009 at 07:48:15PM +0100, Greg Stark wrote:
> On Fri, Aug 7, 2009 at 7:13 PM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
> > Underflow.  x!=y does not imply (x-y) != 0, if x and y are sufficiently
> > small and close together.  The difference could underflow to zero.
> 
> Actually I don't think subtraction can underflow with IEEE floats but
> I don't think we want to count on IEEE floats everywhere. Even if we
> did there's the risk on intel that FPeq() gets called on values which
> have just been calculated and are still in registers but then get
> spilled to RAM and lose precision before the division happens.

If it does one subtraction in registers you can be reasonably certain
the other will be, either way just doing the subtraction and explicitly
testing if it's zero will do the right thing--the semantics of C are bad
but not that bad.

--  Sam  http://samason.me.uk/


pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: GRANT ON ALL IN schema
Next
From: "Kevin Grittner"
Date:
Subject: Re: Review: Revise parallel pg_restore's scheduling heuristic