R NA-skipping modes ignore both NA and NaN:

> mean(c(0, 1, NA), na.rm='true')
[1] 0.5
> mean(c(0, 1, NaN), na.rm='true')
[1] 0.5

Although without skipping enabled, the result does reflect the original NA/NaN:

> mean(c(0, 1, NaN), na.rm='false')
[1] NaN
> mean(c(0, 1, NA), na.rm='false')
[1] NA

Given the factor of 10 slowdown in checking for NA mentioned by Jordi,
I feel that distinguishing between the two for NA-skipping is not
warranted, except perhaps as an additional selectable option. We could
remove the shadowing concern of using the NaN toolbox by adding a mode
like na.rm='true' to the main functions that would switch to the NaN
toolbox functionality, while preserving by default the treatment of
NaN as an invalid value. There could be a global flag that could be
set by users to change the default to NA-skipping so that existing
code that uses NaN-toolbox functions would not need to add a flag to
use the new mode at each invocation of functions like mean.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to