[Rd] Rinternals.h could expose macros for ISNA and ISNAN for CPLXSXP

Scott Ritchie @@r|tch|e73 @end|ng |rom gm@||@com
Tue Jan 28 17:34:03 CET 2020


Apologies if this has been suggested before (I had a search throug the
archives and couldn't find anything).

Currently Rinternals.h includes macros for testing whether an Rboolean,
int, double, or CHARSXP are NA, and whether a double is NaN. As far as I
can tell, no such macro exists for testing whether an Rcomplex is NA or NAN.

These can simply be defined by applying the current ISNA and ISNAN macros
used for  REALSXP on the real and imaginary components of the Rcomplex
struct, and could be included in either R_ext/Arith.h or R_ext/Complex.h

```
#define ISNA_COMPLEX(x) (ISNA(x.r) || ISNA(x.i))
#define ISNAN_COMPLEX(x) (ISNAN(x.r) || ISNAN(x.i))
```

Best,

Scott Ritchie

	[[alternative HTML version deleted]]



More information about the R-devel mailing list