help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NA and NaN


From: John W. Eaton
Subject: Re: NA and NaN
Date: Wed, 12 Mar 2008 12:07:27 -0400

On 12-Mar-2008, Francesco Potorti` wrote:

| >From a more general point of view, is it true that NA is only used by
| Octave and R, while the rest of the world uses Nan?

I'm not sure, but I doubt that very many other systems use the
particular value of NaN for NA that is used by R and Octave (which
copied it from R, for compatibility with R).

I think generic NaN as missing value is a bad choice because it is
then impossible to tell whether a NaN value is missing data or just
the result of a failed calculation.

Another possibility for implementing missing values is to use a
special value class (or classes) that include some sort of list
attached to them that indicates which values are missing.  But then
every function that operates on these objects must deal with the
missing data list.  Perhaps there is a slick way to do this that
avoids duplicating too much code, but I don't see it.

The appeal of using a special NaN value for NA is that you shouldn't
have to do anything special for library functions, provided that they
preserve NaN values.  But as I mentioned in my previous post, we've
recently found that this assumption is not always valid.  So to really
make NA work, it seems you still have to have special case code for NA.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]