## 9.3.109 NINT (A [, KIND])

Description: | Returns the nearest integer to the argument.
Class: | Elemental function; Generic
Arguments: | A | Must be of type real.
| KIND (opt) | Must be a scalar integer initialization expression.
Results: | The result is of type integer. If KIND is present, the kind parameter of the result is that specified by KIND; otherwise, the kind parameter of the result is shown in the following table. If the processor cannot represent the result value in the kind of the result, the result is undefined. If A is greater than zero, NINT (A) has the value INT (A + 0.5); if A is less than or equal to zero, NINT (A) has the value INT (A - 0.5).

Specific Name | Argument Type | Result Type
--- | --- | ---
ININT | REAL(4) | INTEGER(2)
NINT 1,2 | REAL(4) | INTEGER(4)
KNINT | REAL(4) | INTEGER(8)
IIDNNT | REAL(8) | INTEGER(2)
IDNINT 2,3 | REAL(8) | INTEGER(4)
KIDNNT | REAL(8) | INTEGER(8)
IIQNNT | REAL(16) | INTEGER(2)
IQNINT 2,4 | REAL(16) | INTEGER(4)
KIQNNT 5 | REAL(16) | INTEGER(8)
1 Or JNINT. 2 The setting of compiler options specifying real size can affect NINT, IDNINT, and IQNINT. 3 Or JIDNNT. For compatibility with older versions of Fortran, IDNINT can also be specified as a generic function. 4 Or JIQNNT. For compatibility with older versions of Fortran, IQNINT can also be specified as a generic function. 5 This specific function cannot be passed as an actual argument.

Examples

NINT (3.879) has the value 4.

NINT (-2.789) has the value -3.

Previous Page Next Page Table of Contents