I think NA+0 should be special, though. All of mine give > NA+NaN [1] NA > NaN+NA [1] NA
That's with four separate compilers on Sparc-Solaris as well as Windows and Linux i686. I have long wondered why it works .... On Wed, 17 Mar 2004, Liaw, Andy wrote: > > From: Thomas Lumley [mailto:[EMAIL PROTECTED] > > > > On Wed, 17 Mar 2004, Liaw, Andy wrote: > > > > > Dear R-devel, > > > > > > Has anyone seen this problem? We tried building R-1.8.1 > > (and R-1.9.0 alpha > > > 2004-03-17) on an Irix 6.5 box using > > > > > > ./configure CC="cc -64" F77="f77 -64" --with-tcltk=no > > --enable-R-shlib > > > > > > make check failed because NA + 0 gave NaN instead of NA. > > I've tried both > > > 32- and 64-bit build, with and without --enable-R-shlib. > > The same symptom > > > occur in all cases. > > > > > > > I haven't seen it before, but it looks to me as though arithmetic.c > > assumes that adding a number to a NaN gives the same NaN > > back, (NA is the > > NaN with lower word 1954). That is, we just do > > #ifdef IEEE_754 > > REAL(ans)[i] = REAL(s1)[i1] + REAL(s2)[i2]; > > #else > > > > This doesn't look as thought it is guaranteed to work, though > > it does on > > most machines. It clearly can't work where both operands are NaN, so > > under OS X I get > > > NA+NaN > > [1] NA > > > NaN+NA > > [1] NaN > > > > > > -thomas > > > > On our Opteron I get: > > > NA+NaN > [1] NaN > > NaN+NA > [1] NA > > OK, now I'm really confused... > > Andy > > > > ------------------------------------------------------------------------------ > Notice: This e-mail message, together with any attachments,...{{dropped}} > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > -- Brian D. Ripley, [EMAIL PROTECTED] 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html