A rounding mode is one of
FP_RZ,
FP_RM,
FP_RN, or
FP_RP, for rounding towards zero, rounding (
Minus infinity) down, rounding to
nearest, and rounding (
Plus infinity) up. The default mode is
FP_RN.
An
fp_except value is a bitmask specifying an exception type and containing any of the values listed below.
FP_X_INV
Invalid Operation
FP_X_IMP
Imprecision (inexact)
FP_X_IOV
Integer Overflow
The
fpsetmask() function will set the current exception mask, i.e., it will cause future operations with the specified result status to raise the
SIGFPE exception. The
fpgetmask() function will return the current exception mask.
The
fpsetround() function will cause future operations to use the specified dynamic rounding mode. The
fpgetround() function will return the current rounding mode.
Note:
On some architectures, instructions can optionally specify static rounding modes and exception enables that will supersede the specified dynamic mode. On other architectures, these features may not be fully supported.
A “sticky” status word may be maintained in which a bit is set every time an exceptional floating point condition is encountered, whether or not a
SIGFPE is generated. The
fpsetsticky() function will set or clear the specified exception history bits. The
fpgetsticky() function will return the exception history bits.