|
|
cc [flag ...] file ... -lm [library ...]#include <math.h>
double rint(double x);
float rintf(float x);
long double rintl(long double x);
long int lrint(double x);
long int lrintf(float x);
long int lrintl(long double x);
long long int llrint(double x);
long long int llrintf(float x);
long long int double llrintl(long double x);
double round(double x);
float roundf(float x);
long double roundl(long double x);
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);
double trunc(double x);
float truncf(float x);
long double truncl(long double x);
lrint, lrintf, lrintl, llrint, llrintf and llrintl round their argument to the nearest integer value, according to the current rounding direction. If the rounded value is outside the range of the return type, the numeric result is unspecified. A range error can occur if the magnitude of x is too large.
round, roundf and roundl round their argument to the nearest integer value in floating-point format, rounding halfway cases away from zero, regardless of the current rounding direction.
lround, lroundf, lroundl llround, llroundf and llroundl round their argument to the nearest integer value in floating-point format, 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. A range error can occur if the magnitude of x is too large.
trunc, truncf and truncl return the nearest integer value that is less than or equal to x.
If the returned value is calculated as falling outside of the range of LLONG_MIN to LLONG_MAX llrint, llrintf, llrintl, llround, llroundf and llroundl return LLONG_MIN instead and set errno to ERANGE.
On systems that support IEEE NaN, if the argument to any of these functions is a quiet NaN, that value is returned. If the argument is a signaling NaN, a quiet NaN is returned and the invalid operation exception is raised. In either case, errno is set to EDOM.