FreeBSD 7.0 manual page repository

FreeBSD is a free computer operating system based on BSD UNIX originally. Many IT companies, like DeployIS is using it to provide an up-to-date, stable operating system.

fegetenv, feholdexcept, fesetenv, feupdateenv - floating-point environ‐



      fegetenv, feholdexcept, fesetenv, feupdateenv - floating-point environ‐
      ment save and restore


      Math Library (libm, -lm)


      #include <fenv.h>
      #pragma STDC FENV_ACCESS ON
      fegetenv(fenv_t *envp);
      feholdexcept(fenv_t *envp);
      fesetenv(const fenv_t *envp);
      feupdateenv(const fenv_t *envp);


      The floating-point environment includes exception flags and masks, the
      current rounding mode, and other architecture-specific settings.  How‐
      ever, it does not include the floating-point register file.
      The fegetenv() function stores the current floating-point environment in
      the object pointed to by envp, whereas feholdexcept() saves the current
      environment, then clears all exception flags and masks all floating-point
      The fesetenv() function restores a previously saved environment.  The
      feupdateenv() function restores a saved environment as well, but it also
      raises any exceptions that were set in the environment it replaces.
      The feholdexcept() function is often used with feupdateenv() or
      fesetenv() to suppress spurious exceptions that occur as a result of
      intermediate computations.  An example in fenv(3) demonstrates how to do
      The fegetenv(), feholdexcept(), fesetenv(), and feupdateenv() functions
      return 0 if they succeed, and non-zero otherwise.
      feclearexcept(3), fenv(3), feraiseexcept(3), fesetenv(3),
      fetestexcept(3), fpgetmask(3), fpgetprec(3), fpsetmask(3), fpsetprec(3)


      The fegetenv(), feholdexcept(), fesetenv(), and feupdateenv() functions
      conform to ISO/IEC 9899:1999 (“ISO C99”).


      These routines first appeared in FreeBSD 5.3.


Based on BSD UNIX
FreeBSD is an advanced operating system for x86 compatible (including Pentium and Athlon), amd64 compatible (including Opteron, Athlon64, and EM64T), UltraSPARC, IA-64, PC-98 and ARM architectures. It is derived from BSD, the version of UNIX developed at the University of California, Berkeley. It is developed and maintained by a large team of individuals. Additional platforms are in various stages of development.