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

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 7 11:47:50 CEST 2004


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?

It is clearly not under your compiler/OS.  We could add a configure test 
for broken systems and fix it in arithmetic.c but it hardly seems 
worthwhile.

> >  R.version
>           _
> platform powerpc-apple-darwin6.8
> arch     powerpc
> os       darwin6.8
> system   powerpc, darwin6.8
> status
> major    1
> minor    9.0
> year     2004
> month    04
> day      12
> language R
> >
> 
> (Both give NA under linux, so it looks like a version-specific issue).

Linux on that hardware?  It might be a chip issue.

-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list