Re: Fixing geometic calculation

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sam Mason <sam(at)samason(dot)me(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixing geometic calculation
Date: 2009-08-07 18:48:15
Message-ID: 407d949e0908071148l1e225622g132bf02987a80993@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 7, 2009 at 7:13 PM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Sam Mason <sam(at)samason(dot)me(dot)uk> writes:
>> On Fri, Aug 07, 2009 at 12:50:39PM -0400, Tom Lane wrote:
>>> No, I'm worried about code that supposes that it can divide by (x - y)
>>> after testing that FPeq(x,y) is not true.  point_sl() for instance.
>
>> OK, but I'm still not sure what you're getting at.
>
> 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.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-07 18:50:33 Re: "PANIC: cannot make new WAL entries during recovery" in the wild
Previous Message Sam Mason 2009-08-07 18:43:39 Re: Fixing geometic calculation