From Kurt.Hornik@ci.tuwien.ac.at  Sun Jul 18 11:38:17 1999
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Sun, 18 Jul 1999 12:38:17 +0200 (CEST)
Subject: 0.65/AIX
In-Reply-To: <x2iu7o5hcv.fsf@blueberry.kubism.ku.dk>
References: <199907131307.JAA29236@infiniti.ece.cmu.edu>
 <199907131333.PAA14854@sophie.ethz.ch>
 <14219.25377.308702.802943@aragorn.ci.tuwien.ac.at>
 <x2vhbozfg7.fsf@blueberry.kubism.ku.dk>
 <14219.27433.90420.114884@aragorn.ci.tuwien.ac.at>
 <x2iu7o5hcv.fsf@blueberry.kubism.ku.dk>
Message-ID: <14225.44697.457131.874849@elendil.ci.tuwien.ac.at>

>>>>> Peter Dalgaard BSA writes:

> Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> writes:
>> On the system I have access to, I can compile only with
>> 
>> -D_XOPEN_SOURCE_EXTENDED=2 (VERY noisy)
>> or
>> -D_ALL_SOURCE
>> 
>> In either case, we get the above.
>> 
>> I will hence use ALL_SOURCE for the time being.
>> 
>> Note that
>> 
>> > 1/0 - 1/0# NaN
>> [1]NaNQ
>> > is.nan(1/0 - 1/0)
>> [1] TRUE
>> 
>> so what is really going on here???

> Double "hmmmm"....

> Can you run this under gdb? If so, could you set a breakpoint in
> EncodeReal and step through it? 

> That'll be (roughly)

> R -d gdb
> (gdb) run
> ^C
> (gdb) break EncodeReal
> (gdb) continue
>> 1/0
> (gdb) next
> <etc.>

> I bet it never enters the "if (!R_FINITE(x))" branch as it should.
> This could happen if HAVE_FINITE and IEEE_754 are both undefined in
> Arith.h, or if finite(x) doesn't work in the IEEE way.

>> From what Martin has been telling us, AIX is using IEEE format numbers
> and arithmetic anyhow, so it should be fairly easy to fudge a better
> R_FINITE (and ISNAN too). I think we went through some of that last
> time we had R_FINITE/ISNAN and friends on the board, didn't we?
> Something pretty close to the following should work:

> #define R_FINITE(x) ({double y = x; \
> 	 *((int *) &y) & 0x7ff00000 != 0x7ff00000})

> #define ISNAN(x) ({double y = x; \
> 	*((int *) &y) & 0x7ff00000 == 0x7ff00000 && \
> 	(*((int *) &y) & 0x7fffffff != 0x7ff00000 || *((int *) &y + 1) != 0)}

> Of course, that kind of code is pretty architecture dependent, etc...
> Perhaps one should first check what the status of IEEE macros in AIX
> really is.

Hmm ... I just realized that the AIX system I have access to has no gdb
(it does have dbx, but I never used it before ...).

Could anyone else try to do the above exercise?

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


0.65/AIX
Kurt Hornik