nint(x)
rounds its argument to the nearest whole number.
FORTRAN 77 and later, with kind
argument Fortran 90 and later
result = nint(x [, kind])
x
- The type of the argument shall be real
.kind
- (Optional) An integer
initialization expression indicating the kind parameter of the result.Returns a
with the fractional portion of its magnitude eliminated by rounding to the nearest whole number and with its sign preserved, converted to an integer
of the default kind.
program test_nint
real(4) x4
real(8) x8
x4 = 1.234E0_4
x8 = 4.321_8
print *, nint(x4), idnint(x8)
end program test_nint