fpgetround(3) CLIX fpgetround(3)
NAME
fpgetround, fpsetround, fpgetmask, fpsetmask, fpgetsticky, fpsetsticky -
Provide IEEE floating-point environment control
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <ieeefp.h>
fp_rnd fpgetround(
void );
fp_rnd fpsetround(
fp_rnd rnd_dir );
fp_except fpgetmask(
void );
fp_except fpsetmask(
fp_except mask );
fp_except fpgetsticky(
void );
fp_except fpsetsticky(
fp_except sticky );
DESCRIPTION
There are five floating-point exceptions: divide-by-zero, overflow,
underflow, imprecise (inexact) result, and invalid operation. When a
floating-point exception occurs, the corresponding sticky bit is set (1),
and if the mask bit is enabled (1), the trap takes place. These functions
let the user change the behavior on occurrence of any of these exceptions,
as well as change the rounding mode for floating-point operations.
The fpgetround() function returns the current rounding mode.
The fpsetround() function sets the rounding mode and returns the previous
rounding mode.
The fpgetmask() function returns the current exception masks.
The fpsetmask() function sets the exception masks and returns the previous
setting.
The fpgetsticky() function returns the current exception sticky flags.
2/94 - Intergraph Corporation 1
fpgetround(3) CLIX fpgetround(3)
The fpsetsticky() function sets (clears) the exception sticky flags and
returns the previous setting.
The default environment on the 3B computer family is:
⊕ Rounding mode set to nearest(FP_RN)
⊕ Divide-by-zero
⊕ Floating point overflow
⊕ Invalid operation traps enabled
One must clear the sticky bit to recover from the trap and to proceed. If
the sticky bit is not cleared before the next trap occurs, a wrong
exception type may be signaled.
For the same reason, when calling fpsetmask() the user should make sure
that the sticky bit corresponding to the exception being enabled is
cleared.
CAUTIONS
The fpsetsticky() function modifies all sticky flags. The fpsetmask()
function changes all mask bits.
Both C and F77 require truncation (round to zero) for floating-point to
integral conversions. The current rounding mode has no effect on these
conversions.
RELATED INFORMATION
Function: isnan(3)
2 Intergraph Corporation - 2/94