Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

IEEE_SET_ROUNDING_MODE

Intrinsic Module Subroutine (Generic): Sets the IEEE rounding mode. This is an impure subroutine.

Module

USE, INTRINSIC :: IEEE_ARITHMETIC

CALL IEEE_SET_ROUNDING_MODE (round_value [, radix])

round_value

(Input) Must be scalar and of type TYPE (IEEE_ROUND_TYPE). It specifies one of the following IEEE floating-point rounding values:

IEEE_DOWN, IEEE_NEAREST, IEEE_TO_ZERO, IEEE_UP, or IEEE_OTHER.

radix

(Input; optional) Must be an integer scalar with a value of ten or two. The rounding mode set is the binary rounding mode unless radix is present with the value of ten, in which case it is the decimal rounding mode set.

Example

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 (ROUND)   ! Restores the previous rounding mode