Next: lround, Previous: logb, Up: Math [Contents][Index]

### 1.39 `lrint`, `lrintf`, `llrint`, `llrintf`—round to integer

Synopsis

    #include <math.h>
    long int lrint(double x);
    long int lrintf(float x);
    long long int llrint(double x);
    long long int llrintf(float x);

Description
The `lrint` and `llrint` functions round their argument to the nearest integer value, using the current rounding direction. If the rounded value is outside the range of the return type, the numeric result is unspecified. A range error may occur if the magnitude of x is too large. The "inexact" floating-point exception is raised in implementations that support it when the result differs in value from the argument (i.e., when a fraction actually has been truncated).

Returns
x rounded to an integral value, using the current rounding direction.

See Also
`lround`

Portability
ANSI C, POSIX