a strange logical bug (PR#162)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Fri, 9 Apr 1999 11:37:42 +0200


> Mine has 
> 
> > as.numeric(is.na(c(NA,NA,1)))
> [1] -1 -1  0
> 
> Which is obviously not OK...
> 
> Seems to affect all numeric NA's:
> 
> > A)))
> [1] -1
> 
> This is on RedHat 5.2 (As Jim, I suspect)

On RH 5.2

       The isnan() function returns a non-zero value if value  is
       "not-a-number" (NaN), and 0 otherwise.

and that non-zero is not defined!

On Solaris:

     isnan(), isnand(), and isnanf() return true (1) if the argu-
     ment dsrc or fsrc is a NaN; otherwise they return false (0).

and isnan is used in Arith.c for ISNAN and that is used in coerce.c
for do_isna (why?)

So ISNAN needs to be redefined on Linux at least.  Using ISNA not ISNAN
solves this one for me.

Brian

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


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