[R] ISNAN() broken? in ver 2.x on MacOS X
Bill Northcott
w.northcott at unsw.edu.au
Tue Jan 4 03:02:10 CET 2005
I have a problem building an extension using ISNAN() on R version 2.0.x.
In R 1.9.1 Arith.h and Rmath.h contained code like
#ifdef IEEE_754
# define ISNAN(x) (isnan(x)!=0)
#else
# define ISNAN(x) R_IsNaNorNA(x)
#endif
#define R_FINITE(x) R_finite(x)
int R_IsNaNorNA(double);
int R_finite(double);
which works.
R 2.0.x has
# define ISNAN(x) (isnan(x)!=0)
unconditionally.
This breaks because on MacOS X in /usr/include/architecture/ppc/math.h
isnan() is itself a macro thus:
#define isnan( x ) ( ( sizeof ( x ) == sizeof(double) ) ?
\
__isnand ( x ) :
\
( sizeof ( x ) == sizeof( float) ) ?
\
__isnanf ( x ) :
\
__isnan ( x ) )
This macro is not substituted because substitution is not recursive. So
the build breaks with 'error: `isnan' undeclared'.
How can I fix this?
Bill Northcott
More information about the R-help
mailing list