Re: [HACKERS] NAN code
От | orion.SAPserv.Hamburg.dsh.de!wieck@sapserv.debis.de |
---|---|
Тема | Re: [HACKERS] NAN code |
Дата | |
Msg-id | m0zxBIM-000EBPC@orion.SAPserv.Hamburg.dsh.de обсуждение исходный текст |
Ответ на | NAN code (Bruce Momjian <maillist@candle.pha.pa.us>) |
Список | 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@debis.com (Jan Wieck) #
В списке pgsql-hackers по дате отправления: