Clicky

Fortran Wiki
anint

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

Description

anint(a [, kind]) rounds its argument to the nearest whole number.

Standard

FORTRAN 77 and later

Class

Elemental function

Syntax

result = anint(a [, kind])

Arguments

  • a - the type of the argument shall be real.
  • kind - (optional) an integer initialization expression indicating the kind parameter of the result.

Return value

The return value is of type real with the kind type parameter of the argument if the optional kind is absent; otherwise, the kind type parameter will be given by kind. If a is greater than zero, anint(a) returns aint(x + 0.5). If a is less than or equal to zero then it returns aint(x - 0.5).

Example

program test_anint
 real(4) x4
 real(8) x8
 x4 = 1.234E0_4
 x8 = 4.321_8
 print *, anint(x4), dnint(x8)
 x8 = anint(x4,8)
end program test_anint

category: intrinsics

Revised on March 13, 2011 16:38:08 by Anonymous Coward (207.192.72.34) (963 characters / 0.0 pages)
Edit | Back in time (2 revisions) | See changes | History | Views: Print | TeX | Source | Linked from: Intrinsic procedures

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