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