[R] NA in C/C++

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun May 28 21:48:10 CEST 2000


On Sun, 28 May 2000 cstrato at EUnet.at wrote:

> Dear Dr. Dalgaard
> 
> Thank you, too, for your fast response.
> 
> I have checked the web-site you mentioned. There is a function:
>     int isnan(floating-type x)
> for floating point numbers, which I could use.
> For integers I will check Arith.h and Arithmetic.c

Unfortunately, we found isnan is not 100% reliable.  R defines

int R_IsNaNorNA(double);

for that purpose, and makes sure it works on all the platforms.
(Note that some platforms that have isnan are marked as non-IEEE
by the configure process.)

My memory is that the real mess came with finite() and Inf/-Inf (at least
one compiler had Inf < 3 true), but we also had problems with isnan
returning a value which differed from true (as in 1 == 1).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list