[UP]


Manual Reference Pages  - nint (3)

NAME

nint(3f) - [FORTRAN:INTRINSIC:NUMERIC] Nearest whole number

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

SYNTAX

result = nint(x [, kind])

DESCRIPTION

nint(x) rounds its argument to the nearest whole number.

ARGUMENTS

X - The type of the argument shall be REAL.
KIND - (Optional) An INTEGER initialization expression indicating the kind parameter of the result.

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

Sample program:

    program demo_nint
      real(4) x4
      real(8) x8
      x4 = 1.234E0_4
      x8 = 4.321_8
      print *, nint(x4), idnint(x8)
    end program demo_nint

STANDARD

[[FORTRAN 77]] and later, with KIND argument [[Fortran 90]] and later

CLASS

[[Elemental procedure|Elemental function]]

SEE ALSO

[[ceiling]], [[floor]]


nint (3) March 18, 2019
Generated by manServer 1.08 from f4aff399-e711-4527-a7d9-6ed9d36746b8 using man macros.