Intel® Fortran Compiler 18.0 Developer Guide and Reference
Intrinsic Module Subroutine (Generic): Stores the current IEEE rounding mode. This is an impure subroutine.
USE, INTRINSIC :: IEEE_ARITHMETIC
CALL IEEE_GET_ROUNDING_MODE (round_value)
round_value |
(Output) Must be scalar and of type TYPE (IEEE_ROUND_TYPE). It returns one of the following IEEE floating-point rounding values: IEEE_DOWN, IEEE_NEAREST, IEEE_TO_ZERO, or IEEE_UP; otherwise, IEEE_OTHER. The result can only be used if IEEE_SET_ROUNDING_MODE is invoked. |
Consider the following:
USE, INTRINSIC :: IEEE_ARITHMETIC
TYPE(IEEE_ROUND_TYPE) ROUND
...
CALL IEEE_GET_ROUNDING_MODE(ROUND) ! Stores the rounding mode
CALL IEEE_SET_ROUNDING_MODE(IEEE_UP) ! Resets the rounding mode
...
CALL IEEE_SET_ROUNDING_MODE(VALUE) ! Restores the previous rounding mode