Re: [Rd] Benefit of treating NA and NaN differently for numerics

From: Duncan Murdoch <>
Date: Thu, 31 Dec 2009 16:10:12 -0500

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,

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 mailing list Received on Thu 31 Dec 2009 - 21:12:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Jan 2010 - 05:10:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive