fp_read_flag() — Return the current floating-point exception status
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
both |
OS/390 V2R6 |
Format
#include <float.h>
#include <fpxcp.h>
fpflag_t fp_read_flag()
General description
The fp_read_flag() function returns the current floating-point exception status.
These functions aid in determining both when an exception has occurred and the exception type. These functions can be called explicitly around blocks of code that may cause a floating-point exception.
- Non-valid operation
- Division by zero
- Overflow
- Underflow
- Inexact
A non-valid operation occurs when the result cannot be represented (for example, a square root operation on a number less than 0).
The IEEE Standard for Binary Floating-Point Arithmetic states: “For each type of exception, the implementation shall provide a status flag that shall be set on any occurrence of the corresponding exception when no corresponding trap occurs. It shall be reset only at the user's request. The user shall be able to test and to alter the status flags individually, and should further be able to save and restore all five at one time.”
- FP_INVALID
- non-valid operation summary
- FP_OVERFLOW
- Overflow
- FP_UNDERFLOW
- Underflow
- FP_DIV_BY_ZERO
- Division by 0
- FP_INEXACT
- Inexact result
Returned value
fp_read_flag() returns the current floating-point exception status. The flags in the returned exception status can be tested using the flag definitions above. You can test individual flags or sets of flags.
Related information
- IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Standards 754-1985 and 854-1987)
- float.h
- fpxcp.h
- fp_clr_flag() — Reset floating-point exception status flag
- fp_raise_xcp() — Raise a floating-point exception
- __isBFP() — Determine application floating-point format