fp_swap_rnd() — Swap rounding mode
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
both
|
OS/390® V2R6
|
Format
#define _AIX_COMPATIBILITY 1
#include <float.h>
fprnd_t fp_swap_rnd(RoundMode)
fprnd_t RoundMode
General description
For an application
running in IEEE Binary Floating-Point mode, the fp_swap_rnd() function
returns the current rounding mode specified by the rounding mode field
of the floating-point control (FPC) register and sets the rounding
mode field in the FPC register based on the value of RoundMode as
follows:
- Value
- Rounding Mode
- _FP_RND_RZ
- Round toward 0
- _FP_RND_RN
- Round to nearest
- _FP_RND_RP
- Round toward +infinity
- _FP_RND_RM
- Round toward -infinity
Notes:
- When processing IEEE Binary Floating-Point values, the z/OS® XL C/C++ runtime library math functions require IEEE rounding mode of round to nearest. The z/OS XL C/C++ runtime library takes care of setting round to nearest rounding mode while executing math functions and restoring application rounding mode before returning to the caller.
- This function will not return or update decimal floating-point rounding mode bits.
Returned value
For an application running in hexadecimal floating-point mode, fp_swap_rnd() returns 0.
For
an application running in IEEE Binary Floating-Point mode, fp_swap_rnd()
returns the previous (changed from) rounding mode as follows:
- Value
- Rounding Mode
- _FP_RND_RZ
- Round toward 0
- _FP_RND_RN
- Round to nearest
- _FP_RND_RP
- Round toward +infinity
- _FP_RND_RM
- Round toward -infinity