[R] noncommutative addition: NA+NaN != NaN+NA

Jari Oksanen jarioksa at sun3.oulu.fi
Tue Sep 7 12:28:11 CEST 2004


On Tue, 2004-09-07 at 12:47, Prof Brian Ripley wrote:
> On Tue, 7 Sep 2004, Robin Hankin wrote:
> 
> > Check this out:
> 
> I am unable to reproduce it on any of the 7 different systems I checked
> (Solaris, Linux, Windows with various compilers).
> 
> > >  NaN +NA
> > [1] NaN
> > >  NA + NaN
> > [1] NA
> > 
> > I thought "+" was commutative by definition.   What's going on?
> 
> > platform powerpc-apple-darwin6.8
> > arch     powerpc
> > os       darwin6.8
> > system   powerpc, darwin6.8
> > status
> > (Both give NA under linux, so it looks like a version-specific issue).
> 
> Linux on that hardware?  It might be a chip issue.

I tried this in Linux on Mac iBook G4, and the results were the same:
NaN+NA was NaN, just like in MacOS X version.  So it looks like a "chip
issue". However, the RPM built from the src.rpm packages at CRAN failed
in some checks in Linux/iBook. 

cheers, jari oksanen
-- 
Jari Oksanen <jarioksa at sun3.oulu.fi>




More information about the R-help mailing list