fenv.5 (2010 09)
f
fenv(5) fenv(5)
NAME
fenv - floating-point environment macros and functions
SYNOPSIS
#include <fenv.h>
DESCRIPTION
The header <fenv.h> declares two types and several macros and functions to provide access to the
floating-point environment. The floating-point environment refers collectively to the floating-point status
flags and control modes. A floating-point status flag is a system variable whose value is set (but never
cleared) when a floating-point exception is raised, which occurs as a side effect of exceptional floating-
point arithmetic to provide auxiliary information. A floating-point control mode is a system variable
whose value may be set by the user to affect the subsequent behavior of floating-point arithmetic; on HP
9000 and HP Integrity servers the control modes include the rounding direction mode, the gradual/flush-
to-zero underflow mode, and the trap enables.
For HP-UX 11i v3 September 2008 Update (and later) for Integrity servers, the floating-point environ-
ment also includes the rounding direction mode for decimal floating point, which is independent of the
rounding direction mode for binary floating point. Both binary and decimal floating point use the same
status flags.
The following types are defined:
fenv_t Represents the entire floating-point environment.
fexcept_t Represents the floating-point exception flags collectively.
The following macros represent the floating-point status flags. They are defined as integral constant
expressions with values such that bitwise ORs of all combinations of the macros result in distinct values.
FE_INEXACT The inexact exception.
FE_DIVBYZERO The division-by-zero exception.
FE_UNDERFLOW The underflow exception.
FE_OVERFLOW The overflow exception.
FE_INVALID The invalid operation exception.
FE_ALL_EXCEPT The bitwise OR of all exception macros.
The following macros represent the rounding direction modes for binary floating point. They are defined
as integral constant expressions with distinct nonnegative values.
FE_TONEAREST The round-to-nearest rounding direction mode.
FE_UPWARD The round-toward-positive-infinity rounding direction mode.
FE_DOWNWARD The round-toward-negative-infinity rounding direction mode.
FE_TOWARDZERO The round-toward-zero rounding direction mode.
The following macro is defined as a pointer to const-qualified
fenv_t:
FE_DFL_ENV The default floating-point environment.
To the ISO/IEC C99 specified facilities, the HP implementation adds four HP-specific functions:
feget-
flushtozero(), fesetflushtozero(), fegettrapenable()
, and fesettrapenable().
For HP-UX 11i v3 September 2008 Update (and later) for Integrity servers, included in a compilation
where
__STDC_WANT_DEC_FP__ has been defined, this file defines the following macros representing
the rounding direction modes for decimal floating point. They are for use with the
fe_dec_getround() and fe_dec_setround() functions. They are defined as integral constant
expressions with distinct nonnegative values.
FE_DEC_TONEAREST
The round-to-nearest decimal rounding direction mode with ties (half-way
cases) to even.
FE_DEC_UPWARD The round-toward-positive-infinity decimal rounding direction mode.
FE_DEC_DOWNWARD
The round-toward-negative-infinity decimal rounding direction mode.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1