fpgetround(3c) DG/UX 4.30 fpgetround(3c)
NAME
fpgetround, fpsetround, fpgetmask, fpsetmask, fpgetsticky,
fpsetsticky - IEEE floating-point environment control
SYNOPSIS
#include <ieeefp.h>
fprnd fpgetround ();
fprnd fpsetround (rnddir)
fprnd rnddir;
fpexcept fpgetmask ();
fpexcept fpsetmask (mask)
fpexcept mask;
fpexcept fpgetsticky ();
fpexcept fpsetsticky (sticky)
fpexcept sticky;
DESCRIPTION
There are five floating-point exceptions: divide-by-zero,
overflow, underflow, imprecise (inexact) result, and invalid
operation. When a floating-point exception is detected, a
trap (SIGFPE) occurs only when the corresponding mask bit is
enabled. Otherwise, the corresponding sticky bit is set and
the standard IEEE-specified fixup is performed on the
result. These routines let the user control the behavior on
occurrence of any of these exceptions, as well as the
rounding mode for floating-point operations.
Fpgetround returns the current rounding mode. Fpsetround
sets the rounding mode and returns the previous rounding
mode. The enumeration type fprnd (defined in <ieeefp.h>)
comprises the following rounding modes:
FP_RN /* round to nearest */
FP_RP /* round to plus */
FP_RM /* round to minus */
FP_RZ /* round to zero (truncate) */
Fpgetmask returns the current exception masks.
Fpsetmask sets the exception masks and returns the previous
setting.
Fpgetsticky returns the current exception sticky flags.
Licensed material--property of copyright holder(s) Page 1
fpgetround(3c) DG/UX 4.30 fpgetround(3c)
Fpsetsticky sets (clears) the exception sticky flags and
returns the previous setting.
The type fpexcept is defined in <ieeefp.h>, along with the
following exception masks:
FP_X_INV /* invalid operation exception */
FP_X_OFL /* overflow exception */
FP_X_UFL /* underflow exception */
FP_X_DZ /* divide-by-zero exception */
FP_X_IMP /* imprecise (loss of precision) */
The following defaults are in effect unless your program
includes the file <ieeefp.h>:
Rounding mode set to nearest (FP_RN).
Divide-by-zero,
floating-point overflow, and
invalid operation traps enabled.
If your program includes the file <ieeefp.h>, all traps are
disabled.
SEE ALSO
isnan(3C).
WARNINGS
Fpsetsticky modifies all sticky flags. Fpsetmask changes
all mask bits.
Both C and F77 require truncation (round to zero) for
floating-point to integral conversions. The rounding mode
has no effect on these conversions.
The sticky bit is never set when the trap for the exception
is enabled. As a result, it is currently impossible to
determine what IEEE floating-point exception occurred from a
C-coded signal handler.
Licensed material--property of copyright holder(s) Page 2