Benefit of treating NA and NaN differently for numerics
On 31/12/2009 3:43 PM, Saptarshi Guha wrote:
Hello, I notice in main/arithmetic.c, that NA and NaN are encoded differently(since every numeric NA comes from R_NaReal which is defined via ValueOfNA) . What is the benefit of treating these two differently? Why can't NA be a synonym for NaN?
I don't know of any cases where a useful distinction is made between NA and NaN, but I suppose it could be useful to know where the bad value came from. R functions rarely generate NaN directly, it usually comes from the hardware or runtime library. And by the way, as the thread containing this message shows, http://finzi.psych.upenn.edu/R/R-devel/2009-August/054319.html there are several different encodings which are displayed as NA, and a huge number (more than 2^50, I seem to recall) of different encodings displayed as NaN. Duncan Murdoch