Next: , Previous: NEW_LINE, Up: Intrinsic Procedures


6.160 NINT — Nearest whole number

Description:
NINT(X) rounds its argument to the nearest whole number.
Standard:
F77 and later
Class:
Elemental function
Syntax:
RESULT = NINT(X)
Arguments:

X The type of the argument shall be REAL.

Return value:
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.
Example:
          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
     

Specific names:

Name Argument Standard
IDNINT(X) REAL(8) F95 and later

See also:
CEILING, FLOOR