NAN code - Mailing list pgsql-hackers

From Bruce Momjian
Subject NAN code
Date
Msg-id 199901010423.XAA26089@candle.pha.pa.us
Whole thread Raw
List pgsql-hackers
I have found a way to assign NAN to a variable, thanks to the library
source code.  Is this better than the code I just posted?  Looks pretty
platform-specific, and we may be better with my earlier code to just use
num, which I have committed to the CURRENT tree.

The strange thing is that isnan(0/0) generates a floating-pointer error
and stops the program, but this does not.  Strange.

---------------------------------------------------------------------------#include <stdio.h>#include <math.h>main(){
double x;    x = 3;        if (isnan((x-x)/(x-x)))        printf("nan\n");    else        printf("not nan\n");}
 

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: NAN code
Next
From: Bruce Momjian
Date:
Subject: Re: 2 patches