Round to the nearest integer value using current rounding direction.
#include <math.h>
long long llrint (x)
double x;
long long llrintf (x)
float x;
long long llrintl (x)
long double x;
long long llrintd32(x)
_Decimal32 x;
long long llrintd64(x)
_Decimal64 x;
long long llrintd128(x)
_Decimal128 x;
The llrint, llrintf, llrintl, llrintd32, llrintd64, and llrintd128 subroutines round the x parameter to the nearest integer value, according to the current rounding direction.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
Item | Description |
---|---|
x | Specifies the value to be rounded. |
Upon successful completion, the llrint, llrintf, llrintl, llrintd32, llrintd64, and llrintd128 subroutines return the rounded integer value.
If x is NaN, a domain error occurs, and an unspecified value is returned.
If x is +Inf, a domain error occurs and an unspecified value is returned.
If x is -Inf, a domain error occurs and an unspecified value is returned.
If the correct value is positive and too large to represent as a long long, a domain error occur and an unspecified value is returned.
If the correct value is negative and too large to represent as a long long, a domain error occurs and an unspecified value is returned.