DESCRIPTION
The routines described herein are deprecated. New code should use the functionality provided by fenv(3). When a floating point exception is detected, the exception sticky flag is set and the exception mask is tested. If the mask is set, then a trap occurs. These routines allow both setting the floating point exception masks, and resetting the exception sticky flags after an exception is detected. In addition, they allow setting the floating point rounding mode and precision.
The fpgetround function returns the current floating point rounding mode.
The fpsetround function sets the floating point rounding mode and returns the previous mode.
The fpgetprec function returns the current floating point precision.
The fpsetprec function sets the floating point precision and returns the previous precision.
The fpgetmask function returns the current floating point exception masks.
The fpsetmask function sets the floating point exception masks and returns the previous masks.
The fpgetsticky function returns the current floating point sticky flags.
The fpresetsticky function clears the floating point sticky flags and returns the previous flags.
Sample code which prevents a trap on divide-by-zero:
fpsetmask(~FP_X_DZ);
a = 1.0;
b = 0;
c = a / b;
fpresetsticky(FP_X_DZ);
fpsetmask(FP_X_DZ);
IMPLEMENTATION NOTES
The fpgetprec and fpsetprec functions provide functionality unavailable on many platforms. At present, they are implemented only on the i386 and amd64 platforms.
SEE ALSO
fenv(3), isnan(3)
CAVEATS
HISTORY