On Mon, Sep 14, 2015 at 8:49 PM, Jeroen Ooms <jeroen.o...@stat.ucla.edu> wrote:
> I tested this hypothesis by replacing '__GNUC__ <= 4' with '__GNUC__ > <= 5' and rebuilding R, but this introduces a whole lot of problems > that were not there before. In particular R crashes when using the > graphics device, which it did not without this fix. I found that the problem goes away when we use isnanl() instead of isnan(). This is very similar to the problem we have for R_pow() where we need to use powl() instead of pow() for recent versions mingw-w64 (this still needs to be patched in r-devel). So the full solution is: #if (defined(_WIN32) || defined(_WIN64)) && defined(__GNUC__) # define R_sqrt(x) (isnanl(x) ? x : sqrt(x)) #else # define R_sqrt sqrt #endif Below the relevant mingw-w64 sources: https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/isnan.c https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/isnanf.c https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-crt/math/isnanl.c I think mingw-w64 takes powl from glibc. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel