ROUND= specifier

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


ROUND = expression

The expression must be a scalar character expression of default kind. It is permitted in the INQUIRE, OPEN, READ and WRITE statements. In the INQUIRE statement, it must be a variable designator and is assigned a value.


The ROUND= specifier determines the default i/o rounding mode (for OPEN), returns the i/o rounding mode (for INQUIRE), or specifies the i/o rounding mode (for READ and WRITE).

The ROUND= specifier is not permitted in an OPEN, READ or WRITE statement that refers to an unformatted file.

In an INQUIRE statement, if the connection is formatted, the variable is assigned a value indicating the i/o rounding mode for the connection: 'COMPATIBLE', 'DOWN', 'NEAREST', 'PROCESSOR_DEFINED', 'UP' or 'ZERO'; if there is no connection, or the connection is unformatted, it is assigned 'UNDEFINED'.

In the OPEN, READ and WRITE statements it must evaluate to one of the previously listed values (except 'UNDEFINED'), ignoring case.

An input/output rounding mode of 'PROCESSOR_DEFINED' is not the same as any of the other rounding modes, but its effects are otherwise undefined. The effects of the other rounding modes are as follows:

These effects are illustrated by the following table; output is with an F4.1 edit descriptor.

1.25 1.3 1.2 1.2 1.3 1.2
1.75 1.8 1.7 1.8 1.8 1.7
−1.25 -1.3 -1.3 -1.2 -1.2 -1.2
−1.75 -1.8 -1.8 -1.8 -1.7 -1.7


FORMAT statement, INQUIRE statement, OPEN statement, WRITE statement