Sets the floating-point environment's flags to the settings in contained a variable of type fexcept_t.
#include <fenv.h> void fesetexceptflag(const fexcept_t *f, int excepts);
f
A pointer to a constant exception flag variable.
excepts
Zero or more exceptions to copy to the floating-point environment.
This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.
#include <fenv.h> #include <stdio.h> #pragma STDC FENV_ACCESS on int main(void) { double result; fexcept_t flags = 0; /* Save the divisdivisionon-by-zero and overflow flags. */ fegetexceptflag(&flags, FE_DIVBYZERO | FE_OVERFLOW); result = 0.0 / 0.0; /* Division by zero! */ /* Restore our flags. */ fesetexceptflag(&flags, FE_DIVBYZERO | FE_OVERFLOW); return 0; }