Important: The information in this document is obsolete and should not be used for new development.
Accessing the Floating-Point Environment
MathLib defines four functions that access the entire floating-point environment:
fegetenv Returns the current environment. feholdexcept Saves the previous environment and clears all exception flags. fesetenv Sets new environmental values. feupdateenv Restores a previously saved environment. These functions take parameters of type
fenv_t
. Typefenv_t
is the environment word type. In general, the environmental access functions either take a pointer to a variable of typefenv_t
or accept the macroFE_DFL_ENV
, which defines the default environment (default rounding direction and all exceptions cleared).