lround, lroundf, lroundl, llround, llroundf, llroundl - round to nearest integer
#include <math.h>
long lround(double x);
long lroundf(float x);
long lroundl(long double x);
long long llround(double x);
long long llroundf(float x);
long long llroundl(long double x);
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.