diff --git a/debug.cpp b/debug.cpp index 03e26d62..dce2f5e6 100644 --- a/debug.cpp +++ b/debug.cpp @@ -70,3 +70,17 @@ void unusual (void) { panic ("Unusual code path found."); } + + +#include + +void +enable_fpe (void) { + feenableexcept (FE_DIVBYZERO | FE_INVALID); +} + + +void +disable_fpe (void) { + feenableexcept (0); +} diff --git a/debug.hpp b/debug.hpp index 15dfd855..b88ebc47 100644 --- a/debug.hpp +++ b/debug.hpp @@ -154,4 +154,8 @@ void unusual (void); void breakpoint (void); + +void enable_fpe (void); +void disable_fpe (void); + #endif // __DEBUG_HPP