Re: [R-pkg-devel] testing for NaN in C++ code

2021-03-06 Thread Dirk Eddelbuettel
On 5 March 2021 at 21:07, Ben Bolker wrote: |Thanks! Now I see this is in Writing R Extensions, should have | looked more carefully ... There is also a very good (and frequently linked-to) post by Kevin on SO which lists the different ways in the C API of R, and the Rcpp wrapper which aims

Re: [R-pkg-devel] testing for NaN in C++ code

2021-03-05 Thread Ben Bolker
Thanks! Now I see this is in Writing R Extensions, should have looked more carefully ... On 3/5/21 9:00 PM, Andrew Simmons wrote: Hello, You probably want one of the following ISNA         TRUE for R's NA only ISNAN      TRUE for R's and IEEE's NaN R_IsNaN   TRUE for IEEE'S NaN only On F

[R-pkg-devel] testing for NaN in C++ code

2021-03-05 Thread Ben Bolker
I would like to test for NaN inside C++ code that lives inside a CRAN package. Following the StackOverflow question linked below, I was using #define isNAN(a) (a!=a) which I *think* used to work, but at some point along the way it stopped working due to compiler/flag changes. I'm thinking of