On Tue, 13 Apr 2010, Riccardo (Jack) Lucchetti wrote:
In my view, NA and NaN are two very different things. As you say,
NaN*0
== NaN, by the definition of NaN. If you restrict the interpretation of NA
to "unknown numbwer (but still a number)", then NA*0==0 makes sense. Let
me give another example: suppose you have individuals whose income Y may be
missing, and their tax rate R (with no missing). Of course Y*R gives you
the amount due. If Y is NA, but R==0, why should you doubt that the amount
due is 0?
So I think that NA and NaN are fundamentally different, and should be
treated as such; note that we don't do this at present: if you try
series foo = ln(normal())
you get NAs rather NaNs. I accept that behaviour such as this should be
fixed, although not a priority IMO.
Good point. I still believe that 0*NA = 0 is fine, so long as NA
(unknown value) and NaN (invalid value) are not conflated. So I
agree we should ensure that the "genr" mechanism does not convert
NaN results to NA.
Strictly, NAs should be confined to values marked as such in
incoming data, values propagated via "genr" on NA input (other
than multiplication by zero), and values marked explicitly by the
user, as in "x[3] = NA" or via "zeromiss()".
Allin