| Description: | Returns the nearest integer to the argument. | ||
| Class: | Elemental function | ||
| Arguments: | A | Must be of type real. | |
| KIND (opt) | Must be a scalar integer initialization expression. | ||
| Results: | The result
type is integer. If KIND is present, the kind parameter is that
specified by KIND; otherwise, see the following table for the kind
parameter. 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).
The setting of compiler options specifying integer size can affect this function. | ||
| Specific Name | Argument Type | Result Type |
|---|---|---|
| ININT | REAL(4) | |
| NINT[1] | REAL(4) | INTEGER(4) |
| KNINT | REAL(4) | INTEGER(8) |
| IIDNNT | REAL(8) | INTEGER(2) |
| IDNINT[2] | REAL(8) | INTEGER(4) |
| KIDNNT | REAL(8) | INTEGER(8) |
| IIQNNT | REAL(16) | INTEGER(2) |
| IQNINT[3] | REAL(16) | INTEGER(4) |
| KIQNNT[4] | REAL(16) | INTEGER(8) |
|
[1] Or JNINT.
| ||
Examples
NINT (3.879) has the value 4.
NINT (-2.789) has the value -3.