fp_raise_xcp() — Raise a floating-point exception

Standards

Standards / Extensions C or C++ Dependencies

both

OS/390 V2R6

Format

#include <fpxcp.h>

int fp_raise_xcp(mask)
fpflag_t mask;

General description

The fp_raise_xcp() function causes floating-point exceptions defined by the mask parameter to be raised immediately.

If the exceptions defined by the mask parameter are enabled and the program is running in serial mode, the signal for floating-point exceptions, SIGFPE, is raised.
Note: This function works only in IEEE Binary Floating-Point. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
The fpxcp.h file defines the following names for the flags indicating floating-point exception status:
FP_INVALID
Invalid operation summary
FP_OVERFLOW
Overflow
FP_UNDERFLOW
Underflow
FP_DIV_BY_ZERO
Division by 0
FP_INEXACT
Inexact result
Users can cause multiple exceptions using fp_raise_xcp() by OR-ing the names of individual flags. For example, the following causes both overflow and division by 0 exceptions to occur.
fp_raise_xcp(FP_OVERFLOW | FP_DIV_BY_ZERO)

If more than one exception is included in the mask variable, the exceptions are raised in the following order:

  1. Non-valid operation
  2. Division by zero
  3. Underflow
  4. Overflow
  5. Inexact result

Thus, if the user exception handler does not disable further exceptions, one call to the fp_raise_xcp() function can cause the exception handler to be entered many times.

Returned value

If successful, fp_raise_xcp() returns 0.

If unsuccessful, fp_raise_xcp() returns nonzero.

Related information