[Numpy-discussion] NaNs and infs

Perry Greenfield perry at stsci.edu
Mon Nov 10 08:27:11 CST 2003

Tim Churches wrote:

> Increasingly we are turning to R (http://www.r-project.org) because it
> provides fully integrated support for Inf, NaN and NA (missing) in all
> its data structures, including matrices and higher-rank arrays, viz:
> > 2/0
> [1] Inf
> > 0/0
> [1] NaN
> > NA/1
> [1] NA
> R can be embedded in Python and passed NumPy arrays or other data
> structures via Walter Moriera's excellent RPy modules (see
> http;//rpy.sf.net).
> However, the fundamental problem is that support for NA (missing), Inf
> and NaN seems to be afterthoughts in both NumPy and numarray, whereas
> such support should have been integrated into the design right from the
> outset.
> Is it too late to incorporate them into the fabric of numarray?
I'm a little surprised at the comment that these issues are viewed as
afterthoughts in numarray. We gave ieee 754 special value handling 
fairly careful thought. We may have missed something however, so I'm
interested to hear what is considered missing in that regard. We allow
the user to set whether ieee errors are ignored, print a warning, or
raise an exception, and do so individually for all four kinds of 
errors. We also allow testing of and setting ieee special values. 
What is missing? (By the way, if one expects to be able to invoke
an error handler for each individual exception that occurs in an array
computation, we determined that that was too difficult to handle in any,
portable and efficient way.)

As to "NA" or "missing values", what is expected? These are not part of
the ieee standard (unless I've missed something). How does this differ
from using NaN, for example?


More information about the Numpy-discussion mailing list