Clicky

Fortran Wiki
aint

Description

aint(a [, kind]) truncates its argument to a whole number.

Standard

FORTRAN 77 and later

Class

Elemental function

Syntax

result = aint(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 the magnitude of x is less than one, aint(x) returns zero. If the magnitude is equal to or greater than one then it returns the largest whole number that does not exceed its magnitude. The sign is the same as the sign of x.

Example

program test_aint
  real(4) x4
  real(8) x8
  x4 = 1.234E0_4
  x8 = 4.321_8
  print *, aint(x4), dint(x8)
  x8 = aint(x4,8)
end program test_aint

category: intrinsics