Re: 0.65/AIX

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

Subject: Re: 0.65/AIX
From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Wed 14 Jul 1999 - 08:12:48 EST


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

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.

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


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:05 EST