**Subject: **Re: 0.65/AIX

**From: **Peter Dalgaard BSA (*p.dalgaard@biostat.ku.dk*)

**Date: **Tue 20 Jul 1999 - 19:50:01 EST

**Next message:**Prof Brian Ripley: "RE: time series in R"**Previous message:**Martin Maechler: "Re: time series in R"**Next in thread:**Thomas Vogels: "Re: 0.65/AIX"**Maybe reply:**Peter Dalgaard BSA: "Re: 0.65/AIX"

Message-ID: <x2r9m3fy5y.fsf@blueberry.kubism.ku.dk>

Thomas Vogels <tov@infiniti.ece.cmu.edu> writes:

*> "Peter" == Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:
*

*>
*

*> Peter> Something pretty close to the following should work:
*

*> Peter>
*

*> Peter> #define R_FINITE(x) ({double y = x; \
*

*> Peter> *((int *) &y) & 0x7ff00000 != 0x7ff00000})
*

*> Peter>
*

*> Peter> #define ISNAN(x) ({double y = x; \
*

*> Peter> *((int *) &y) & 0x7ff00000 == 0x7ff00000 && \
*

*> Peter> (*((int *) &y) & 0x7fffffff != 0x7ff00000 || *((int *) &y + 1) != 0)}
*

*>
*

*> Pretty but not close ;-) Sorry, but I can't compile these macros. I
*

*> see your point for the local var, but cc and gcc choke on it.
*

I take it that you fixed the missing ')' in ISNAN? Too bad. Perhaps it

can work without the local "y"? I put it in just to catch cases where

x might be in a register so that you cannot take its address.

*> I've looked into /usr/include/fp.h which is included for AIX
*

*> platforms. (Its version is 1.9) There are defines for FINITE,
*

*> IS_INF, IS_NAN. Can we use them? Roll our own finite()?
*

That would make very good sense. The code would probably have to go in

an "#if aix" type clause, but so would my suggestion.

*> Does it make sense for configure to check, not only whether finite
*

*> exists but also whether it's broken?
*

It certainly would.

*> BTW, if you step thru EncodeReal you see that !R_FINITE(x) if false
*

*> for 1/0 (i.e. 1/0 is not detected as not finite).
*

Yes. If you look at R_FINITE, you'll see that the logic is

essentially: If HAVE_FINITE use finite() else assume non-IEEE and only

check for the internal NA code. So if either finite() misbehaves or

doesn't exist, that will happen.

*> Here is first the C code to show what's working what's not. (I picked
*

*> your stuff and added the calls to the macros.) This is followed by
*

*> the output when compiled with cc and gcc. I'm having major headaches
*

*> here with the -D_XOPEN_SOURCE_EXTENDED (details follow). Maybe we can
*

*> dump finite in favor of FINITE?
*

*>
*

*> Are my assumptions about the return values are correct?
*

They look fine. Would seem that only gcc without the -D_XOPENetc is

having trouble with finite() -- why? could that be a gcc bug?

What happens with isnan(), is that as buggy as finite()?

It looks quite feasible simply to put

#ifdef _AIX

#define R_FINITE(x) FINITE(X)

#define R_ISNAN(x) IS_NAN(X)

#endif

or something like it in Arith.h

-- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

**Next message:**Prof Brian Ripley: "RE: time series in R"**Previous message:**Martin Maechler: "Re: time series in R"**Next in thread:**Thomas Vogels: "Re: 0.65/AIX"**Maybe reply:**Peter Dalgaard BSA: "Re: 0.65/AIX"

*
This archive was generated by hypermail 2b25
: Tue 04 Jan 2000 - 14:16:06 EST
*