Re: Fixing geometic calculation - Mailing list pgsql-hackers

From marcin mank
Subject Re: Fixing geometic calculation
Date
Msg-id b1b9fac60908081941u30cdc5b9h23e500386d8f52b2@mail.gmail.com
Whole thread Raw
In response to Re: Fixing geometic calculation  (Paul Matthews <plm@netspace.net.au>)
Responses Re: Fixing geometic calculation  (Paul Matthews <plm@netspace.net.au>)
List pgsql-hackers
On Sat, Aug 8, 2009 at 3:07 AM, Paul Matthews<plm@netspace.net.au> wrote:

> IEEE754 does not allow two number X and Y, such that X!=Y and (X-Y)==0.
> And since IEEE754 has been around since the 70's or 80's I think we can
> start relying on its existence and behavior by now.
>

You are correct, I think, though this does not solve the division problem:

$ cat t.c
#include <stdio.h>
int main(){   double a=1.000001e-307, b=1e-307, c=a-b;   printf("a=%le, b=%le, c=%le, c==0:%d, a==b:%d
1/c=%le\n",a,b,c,c==0,a==b,1.0/c);   return 0;
}
$ gcc -Wall -O2 t.c
$ ./a.out
a=1.000001e-307, b=1.000000e-307, c=1.000000e-313, c==0:0, a==b:0 1/c=inf


Greetings
Marcin Mańk


pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Patch for 8.5, transformationHook
Next
From: Robert Haas
Date:
Subject: Re: join removal