lround
, lroundf
, llround
, llroundf
—round to integer, to nearest#include <math.h> long int lround(double x); long int lroundf(float x); long long int llround(double x); long long int llroundf(float x);
Description
The lround
and llround
functions round their argument to the
nearest integer value, rounding halfway cases away from zero, regardless
of the current rounding direction. If the rounded value is outside the
range of the return type, the numeric result is unspecified (depending
upon the floating-point implementation, not the library). A range
error may occur if the magnitude of x is too large.
Returns
See Also
round
functions for the return being the same floating-point type
as the argument. lrint
, llrint
.
Portability