anint(x, [kind]): Round to Nearest Whole Number¶
Round to nearest whole number.
Declaration¶
Sintaxe¶
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 de retorno¶
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.
Descrição¶
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.
Exemplos¶
program intrinsics_anint
print *, anint(2.6)
print *, anint(-2.6)
end program
Resultado:
3.0
-3.0
Veja Também¶
aint.