anint(x, [kind]): Round to Nearest Whole Number¶
Round to nearest whole number.
Declaración¶
Sintaxis¶
retval = anint(x, [kind])
elemental real function anint(x, [kind])
Argumentos¶
x
the input value must be of type real.
kind
the optional input parameter initialises the kind of the result.
Valores devueltos¶
The return value is of type integer(kind) if kind is passed as input parameter. If not, default kind real is returned.
The return value is equal to rounded whole number.
Descripción¶
anint(x) calculates rounded value of input parameter x
.
If x
is less than or equal to 0 i.e., if x
is negative or 0, anint(x)
returns aint(x - 0.5)
.
If x
is greater than 0, anint(x)
returns aint(x + 0.5)
.
The optional parameter kind
specifies the kind of the result.
Tipos¶
Supported argument types is real.
Ejemplos¶
program intrinsics_anint
print *, anint(2.6)
print *, anint(-2.6)
end program
Result:
3.0
-3.0
Ver también¶
aint.