Re: Fixing geometic calculation

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixing geometic calculation
Date: 2009-08-07 18:59:37
Message-ID: 20090807185937.GP5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2009-08-07 19:08:21 Re: Review: Revise parallel pg_restore's scheduling heuristic
Previous Message Petr Jelinek 2009-08-07 18:51:37 Re: GRANT ON ALL IN schema