The AINT function truncates a real number by removing its fractional part.
SyntaxAINT (a [, kind])
a is an INTENT(IN) scalar or array of type REAL.
kind is a number which determines the kind of the result. It must be a scalar INTEGER expression that can be evaluated at compile time. To maintain portability, this argument should be the result of a KIND Function or SELECTED_REAL_KIND Function.
The result is equal to the value of a without its fractional part.
If kind is present, the result is a REAL value of kind kind, otherwise it is the same kind as a.
Examplereal(kind=kind(1.e0)) :: r1=-7.32, r2=1.999999 real(kind=kind(1.d0)) :: dr write(*,*) aint(r1,kind(r1)) ! writes -7.000000 write(*,*) aint(r2, kind(dr)) ! writes 1.0000000000000