FE_
DFL_ ENV feupdateenv
fesetenv
fegetenv
feholdexcept
Name | Description | Notes | Source | Availability | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FE_ |
All floating-point exceptions | M | <fenv.h> |
C99 | C11 | ||||||
FE_ |
Default floating-point environment | M | <fenv.h> |
C99 | C11 | ||||||
FE_ |
Floating-point exception: division by zero | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point rounding mode: downward | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point exception: inexact computation | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point exception: invalid representation | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point exception: overflow | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point rounding mode: to nearest | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point rounding mode: toward zero | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point exception: underflow | ? | M | <fenv.h> |
C99 | C11 | |||||
FE_ |
Floating-point rounding mode: upward | ? | M | <fenv.h> |
C99 | C11 | |||||
FENV_ |
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 |
The floating-point environment is a collection of:
- status flags that record when each kind of floating-point exception has occurred as a result of a mathematical computation; and
- control modes that influence how future mathematical
computations will proceed, including rounding, and whether exceptions
should raise a signal [such as
SIGFPE
?].
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:
- no function should alter the caller's control modes;
- no function should clear any exception flags (but it can set them);
- no function should depend on exception flags;
- every function should assume that the caller is using default control modes at the point of invocation;
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:
fesetround
fegetround
fegetenv
feholdexcept
feupdateenv
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_
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?
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>
.]