lround, lroundf, lroundl, llround, llroundf, llroundl - round to nearest integer
#include <math.h>
long int lround(double x);
long int lroundf(float x);
long int lroundl(long double x);
long long int llround(double x);
long long int llroundf(float x);
long long int llroundl(long double x);
Link with -lm
.
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
These functions return the rounded integer value.
If x
is a NaN or an infinity, or the rounded value is too large to be stored in a long
(long long
in the case of the ll* functions), then a domain error occurs, and the return value is unspecified.