Last active
February 11, 2019 16:27
-
-
Save cartazio/b7808e598686c1c025df022aff24ac3a to your computer and use it in GitHub Desktop.
NAN NAN you cant get the undefined float value man
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install("inline")# not needed after the first time | |
library("inline") | |
nanBoom <- cfunction(c(dummy="ANY"),body=" | |
fenv_t fenv; | |
unsigned int new_excepts = FE_DIVBYZERO | FE_INVALID ; | |
fegetenv(&fenv); | |
fenv.__mxcsr &= ~(new_excepts << 7); | |
fesetenv(&fenv); | |
return dummy; | |
",includes="#include <fenv.h>",language="C") | |
nanBoom(1) | |
0.0 /0.0# then R exits silently with SIGFPE and no error handling support |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment