Names specified for <fenv.h>, “Floating-point environment”
Name Description Notes Source Availability
FE_ALL_EXCEPT All floating-point exceptions M <fenv.h> C99 C11
FE_DFL_ENV Default floating-point environment M <fenv.h> C99 C11
FE_DIVBYZERO Floating-point exception: division by zero ? M <fenv.h> C99 C11
FE_DOWNWARD Floating-point rounding mode: downward ? M <fenv.h> C99 C11
FE_INEXACT Floating-point exception: inexact computation ? M <fenv.h> C99 C11
FE_INVALID Floating-point exception: invalid representation ? M <fenv.h> C99 C11
FE_OVERFLOW Floating-point exception: overflow ? M <fenv.h> C99 C11
FE_TONEAREST Floating-point rounding mode: to nearest ? M <fenv.h> C99 C11
FE_TOWARDZERO Floating-point rounding mode: toward zero ? M <fenv.h> C99 C11
FE_UNDERFLOW Floating-point exception: underflow ? M <fenv.h> C99 C11
FE_UPWARD Floating-point rounding mode: upward ? M <fenv.h> C99 C11
FENV_ACCESS Warn of access to floating-point environment P <fenv.h> C99 C11
feclearexcept() Clear floating-point exceptions (·) <fenv.h> C99 C11
fegetenv() Get Get floating-point environment (·) <fenv.h> C99 C11
fegetexceptflag() Get floating-point exception flags (·) <fenv.h> C99 C11
fegetround() Get floating-point rounding direction (·) <fenv.h> C99 C11
feholdexcept() Save floating-point environment (·) <fenv.h> C99 C11
fenv_t Floating-point status T <fenv.h> C99 C11
feraiseexcept() Raise floating-point exceptions (·) <fenv.h> C99 C11
fesetenv() Set Get floating-point environment (·) <fenv.h> C99 C11
fesetexceptflag() Set floating-point exception flags (·) <fenv.h> C99 C11
fesetround() Set floating-point rounding direction (·) <fenv.h> C99 C11
fetestexcept() Test floating-point exceptions (·) <fenv.h> C99 C11
feupdateenv() Restore Get floating-point environment (·) <fenv.h> C99 C11
fexcept_t Floating-point exception status T <fenv.h> C99 C11

This header is available in C99 and C11.

[ Work in progress : This still needs more consideration.]

The floating-point environment is a collection of:

The FP environment has thread-local storage, and all functions that operate on it access the environment of the current thread. Furthermore, by convention, unless documented to do so:

These conventions are designed to allow a programmer to be unconcerned with the FP environment if not conscious of it.

Functions that access the status flags include:

Functions that access the environment in general include:

The header <fenv.h> declares types, macros and functions for accessing the FP environment. fenv_t is a type used to store the entire FP environment, while fexcept_t can store only the state of the exception flags.

#pragma STDC FENV_ACCESS on-off-switch
on-off-switch
ON
OFF
DEFAULT

The pragma FENV_ACCESS must be enabled before using functions from <fenv.h>, or the behaviour of those functions is undefined. The effect of the pragma can have block scope or file scope. Within a block, it must occur at the very beginning; multiple such pragmas may occur together at the beginning, but what would be the point, except in generated code?

[ Work in progress : List exactly which functions are covered by FENV_ACCESS, if not all. Some might not operate on the FP environment, just on the caller's arguments. Actually, it does seem to be all of them in <fenv.h>.]

Missing

  • FE_DFL_ENV
  • feupdateenv
  • fesetenv
  • fegetenv
  • feholdexcept

CHaR
Sitemap Supported
Site format updated 2024-06-05T22:37:07.391+0000
Data updated 1970-01-01T00:00:00.000+0000
Page updated 2023-10-04T20:24:03.213+0000