| From: | jwieck(at)debis(dot)com (Jan Wieck) |
|---|---|
| To: | maillist(at)candle(dot)pha(dot)pa(dot)us (Bruce Momjian) |
| Cc: | hackers(at)postgreSQL(dot)org |
| Subject: | Re: [HACKERS] NAN code |
| Date: | 1999-01-04 08:21:33 |
| Message-ID: | m0zx5GY-000EBPC@orion.SAPserv.Hamburg.dsh.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
>
> I have changed the NAN code, so if NAN is not defined, we just use 'num'
> as NAN, since we only get here if num is NAN. Seems like a good fix for
> platforms that can't assign a NAN to a variable.
>
> ---------------------------------------------------------------------------
>
> if (NUMERIC_IS_NAN(num))
> {
> result = (float32)palloc(sizeof(float32data));
> #ifdef NAN
> *result = NAN;
> #else
> *result = num;
> #endif
> return result;
> }
And I where so happy to have finally found that damned NAN
define :-}
Anyway - that above is absolutely wrong.
num is of type Numeric, which is a pointer to struct
NumericData! So the above should result in some compiler
warning (in fact it type casts a pointer into a double value
- and that will give unpredictable results).
Seems that only isnan() is defined as part of Posix. But not
a definition that can force a NAN. So we have to find a
portable way to define the value NaN for double and float.
Does anybody know of such a way?
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jan Wieck | 1999-01-04 08:24:01 | Re: [HACKERS] Error creating index |
| Previous Message | Thomas G. Lockhart | 1999-01-04 07:12:29 | Re: Date/time fixes for HAVE_TM_ZONE platforms |