Created
December 23, 2011 21:31
-
-
Save bbannier/1515409 to your computer and use it in GitHub Desktop.
Enable floating point eceptions
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
#include <fenv.h> | |
// enable protection against fishy floating point arithmetic | |
void __attribute__ ((constructor)) trapfe() { | |
feenableexcept(FE_INVALID | FE_OVERFLOW | FE_DIVBYZERO); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment