35 #if defined (HAVE_FPSETMASK)
43 {
return (
int)fpgetmask(); }
46 { fpsetmask( (fp_except)state ); }
49 { fpsetmask( fpgetmask()|FP_X_INV|FP_X_OFL|FP_X_DZ ); }
57 #elif defined (HAVE_FEENABLEEXCEPT)
60 # define MSQ_SET_GNU_SOURCE
64 #ifdef MSQ_SET_GNU_SOURCE
66 # undef MSQ_SET_GNU_SOURCE
74 {
return fegetexcept(); }
77 { feenableexcept( state ); }
81 const int flags = FE_DIVBYZERO|FE_INVALID|FE_OVERFLOW;
82 feclearexcept( flags );
83 feenableexcept( flags );
92 #elif defined (_MSC_VER)
100 {
return _MCW_EM & ~_controlfp(0,0); }
103 { _controlfp( state, _MCW_EM ); }
107 const int flags = _EM_ZERODIVIDE|_EM_INVALID|_EM_OVERFLOW;
108 _controlfp( _controlfp(0,0) & ~flags, _MCW_EM );
146 set_current_fpe_state( prevState );
static void enable_trap_fpe()
bool isEnabled
Saved constructor argument for use in destructor.
static void set_current_fpe_state(int state)
MsqFPE(bool enabled)
Set FPE state.
int prevState
Saved FPE state for use in destructor.
static bool fpe_trap_supported()
Check if FPE state manipulation is supported on this platform.
static int get_current_fpe_state()
~MsqFPE()
Restore FPE state.