From p.dalgaard@biostat.ku.dk  Wed May 12 14:13:15 1999
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 12 May 1999 15:13:15 +0200
Subject: matrix() can't handle NaN (PR#193)
In-Reply-To: ripley@stats.ox.ac.uk's message of "Wed, 12 May 1999 13:07:00 +0200 (MET DST)"
References: <199905121107.NAA29025@pubhealth.ku.dk>
Message-ID: <x2zp3abfdg.fsf@blueberry.kubism.ku.dk>

ripley@stats.ox.ac.uk writes:

> > Splus> is.nan(as.double("NaN"))
> > [1] T
> 
> and so does my R on Solaris. On Linux
> 
> > is.nan(as.double("NaN"))
> Warning: NAs introduced by coercion
> [1] FALSE
> 
> so I think there is a problem with Linux versions specifically. The
> conversion is done by strtod. Solaris says (same man page)
> 
>      If str is NaN, then atof() returns NaN.
> 
> This sort of mess is my underlying objection: should we be assuming
> IEEE arithmetic, let alone a particular implementation of it?

Aha! I wonder if that is a Solaris specialty or actually conforming to
standards? A little digging on deja.com turned up a couple of blanket
statements to the effect that "any implementation where strtod can
return NaN is broken", but I'm not too sure about their authority.
Even the textual representation "NaN" is IEEE-854, not 754....

Whatever. I think we should fix as.double() (really: as.vector(x,
"double")) to accept the IEEE extended values in the same way that the
language itself does. 

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


matrix() can't handle NaN (PR#193)
Peter Dalgaard BSA