dcgerard / ldsep

Linkage Disequilibrium Shrinkage Estimation for Polyploids
https://dcgerard.github.io/ldsep/
GNU General Public License v3.0
8 stars 2 forks source link

Switch DOUBLE_EPS to DBL_EPSILON to support STRICT_R_HEADERS #5

Closed eddelbuettel closed 3 years ago

eddelbuettel commented 3 years ago

Dear David,

The Rcpp team is trying to move towards defining STRICT_R_HEADERS by default. Please the issue ticket at https://github.com/RcppCore/Rcpp/issues/1158 for motivation and history.

Your package uses (in several files) DOUBLE_EPS but when STRICT_R_HEADERS is in use the equivalent DBL_EPSILON is preferred. You can set STRICT_R_HEADERS as a #define in a header or source file, via -DSTRICT_R_HEADERS as a compiler flag, or as a #define in the Rcpp sources as we currently do. We plan to enable STRICT_R_HEADERS by the Jan 2022 release of Rcpp, and will likely offer you a define to suppress it. So if you really do not want the change you can prevent it -- see these lines in Rcpp for details: https://github.com/RcppCore/Rcpp/blob/e79c70e76bc2a776d2d57287f7192dbdbcb292aa/inst/include/Rcpp/r/headers.h#L28-L38

This very simple PR changes DOUBLE_EPS to DBL_EPSILON. Your code will then work with and without STRICT_R_HEADERS as we now include cfloat. To be really safe against older Rcpp release you may want to include it to (or the equivalent float.h). In your case, might be easiest in one common header that defines the tolerance constant.

As discussed in https://github.com/RcppCore/Rcpp/issues/1158, this is not urgent, but we of course welcome relatively prompt resolution at CRAN so when we continue to test for this (at a likely montly pace) so we do not get false positives as we will continue to use the CRAN set of packages (as opposed to hand-curated set of upstream dev versions).

Many thanks for your help, and I hope you continue to find Rcpp helpful. Please don't hesitate to ask if you have any questions.

dcgerard commented 3 years ago

Thanks so much, @eddelbuettel! I just sent an update to CRAN a couple days ago, so I'll send another one with this fix in a month or so.

I really appreciate your work on Rcpp!

eddelbuettel commented 3 years ago

Yes I saw that yesterday when working on it :-/ Guess I just missed the update. I am also careful to not overuse them so folding it into the next normal update seems prudent. Thanks for the prompt merge though!

dcgerard commented 3 years ago

ldsep 2.1.2 is on its way to CRAN.