Re: 0.65/AIX

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: 0.65/AIX
From: Thomas Vogels (
Date: Wed 21 Jul 1999 - 05:10:31 EST

Message-Id: <>

(Note that I took the liberty of resequencing Peter's email.)

"Peter" == Peter Dalgaard BSA <> writes:

>> 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()?

Peter> That would make very good sense. The code would probably have to go in
Peter> an "#if aix" type clause, but so would my suggestion.

Peter> It looks quite feasible simply to put
Peter> #ifdef _AIX
Peter> #define R_FINITE(x) FINITE(X)
Peter> #define R_ISNAN(x) IS_NAN(X)
Peter> #endif
Peter> or something like it in Arith.h
With these changes, R crashes when compiled with gcc. I may have
gotten something wrong with the ifdefs, however. Shouldn't it be
possible to compile with HAVE_FINITE and HAVE_ISNAN undefined?

Peter> Thomas Vogels <> writes:
>> "Peter" == Peter Dalgaard BSA <> writes:
Peter> Something pretty close to the following should work:
Peter> #define R_FINITE(x) ({double y = x; \
Peter> *((int *) &y) & 0x7ff00000 != 0x7ff00000})
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.

Peter> I take it that you fixed the missing ')' in ISNAN? Too bad. Perhaps it
Peter> can work without the local "y"? I put it in just to catch cases where
Peter> x might be in a register so that you cannot take its address.

It's actually a missing semicolon before the closing brace. Fixing it
makes it compile with gcc not cc. (And I currently have to use cc to
get a working R.)

-- (Tom Vogels)   Tel: (412) 268-6638   FAX: -3204

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

About this list Date view Thread view Subject view Author view Other groups

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