anint(3f) - [FORTRAN:INTRINSIC:NUMERIC] Nearest whole number
Syntax
Description
Arguments
Return Value
Example
Standard
Class
result = anint(a [, kind])
anint(a [, kind]) rounds its argument to the nearest whole number.
A - the type of the argument shall be REAL. KIND - (optional) an INTEGER initialization expression indicating the kind parameter of the result.
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).
Sample program:
program demo_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 demo_anint
[[FORTRAN 77]] and later
[[Elemental procedure|Elemental function]]
anint (3) | March 18, 2019 |