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

ID 767251
Date 3/31/2023
Public

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

Document Table of Contents

IEEE_RINT

Elemental Module Intrinsic Function (Generic): Returns an integer value rounded according to the current rounding mode.

Module

USE, INTRINSIC :: IEEE_ARITHMETIC

result = IEEE_RINT (x [, round])

x

(Input) Must be of type REAL.

round

(Input; optional) Must be of type TYPE (IEEE_ROUND_TYPE).

Results

The result type and kind are the same as x.

The value of the result is x rounded to an integer according to the current rounding mode if round is not present. If round is present, the value of the result is x rounded to an integer according to the mode specified by round; this is the operation roundToInteger (rounding) as specified by ISO/IEC/IEEE 60559:2011.

If the result value is zero, the sign is the same as x.

The rounding mode specified by round, if present, is used to perform the conversion. The rounding mode before and after the call remains unchanged.

Example

If the current rounding mode is IEEE_UP, the value of IEEE_RINT (2.2) is 3.0.

If the current rounding mode is IEEE_NEAREST, the value of IEEE_RINT (2.2) is 2.0.

The value of IEEE_RINT (7.4, IEEE_DOWN) is 7.0.