Clicky

Fortran Wiki
nint (Rev #1, changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #0 to #1: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

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

Standard

Fortran 77 and later, with kind argument Fortran 90 and later

Class

Elemental function

Syntax

result = nint(x [, kind])

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

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

See also

ceiling, floor

category: Intrinsics

Revision from April 26, 2009 19:21:01 by Jason Blevins
Forward in time (to current) | See current | History | Rollback | View: Source | Linked from: Intrinsic procedures, ceiling, floor

AltStyle によって変換されたページ (->オリジナル) /