[Rd] Standalone Mathlib, C++ and ISNAN()
Thomas Lumley
tlumley at u.washington.edu
Wed Jan 5 20:53:29 CET 2005
On Thu, 6 Jan 2005, Bill Northcott wrote:
> As I explained in the last message:
>>> In R2.0 ISNAN() is defined using isnan thus (isnan(x)!=0). isnan() is in
>>> math.h and this works perfectly for C code. However, in C++ the header
>>> cmath (included by iostream and others) undefs isnan(). So on platforms
>>> for which isnan() is a macro, the code breaks at compile time with
>>> 'isnan() undeclared'.
I believe (with a little Googling) the suggested C++ approach is to use
std::isnan if <cmath> is included.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-devel
mailing list