Rinternals.h could expose macros for ISNA and ISNAN for CPLXSXP

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Rinternals.h could expose macros for ISNA and ISNAN for CPLXSXP

Scott Ritchie-2
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]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel