Next: matherr, Previous: lrint, Up: Math [Contents][Index]

### 1.40 `lround`, `lroundf`, `llround`, `llroundf`—round to integer, to nearest

Synopsis

    #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
x rounded to an integral value as an integer.

See Also
See the `round` functions for the return being the same floating-point type as the argument. `lrint`, `llrint`.

Portability
ANSI C, POSIX