std::rint,std::rintf,std::rintl,std::lrint,std::lrintf,std::lrintl,std::llrint, (3) - Linux Manuals
std::rint,std::rintf,std::rintl,std::lrint,std::lrintf,std::lrintl,std::llrint,: std::rint,std::rintf,std::rintl,std::lrint,std::lrintf,std::lrintl,std::llrint,
NAME
std::rint,std::rintf,std::rintl,std::lrint,std::lrintf,std::lrintl,std::llrint, - std::rint,std::rintf,std::rintl,std::lrint,std::lrintf,std::lrintl,std::llrint,
Synopsis
Defined in header
float rint
float rintf(
double rint
long double rint
long double rintl(
double rint
long lrint
long lrintf(
long lrint
long lrint
long lrintl(
long lrint
long long llrint
long long llrintf(
long long llrint
long long llrint
long long llrintl(
long long llrint
1-3)
format), using the current rounding mode.
5-7, 9-11)
current rounding mode.
4,8,12)
integral type. Equivalent to
double).
Parameters
arg - floating point value
Return value
If no errors occur, the nearest integer value to arg, according to the current
rounding mode, is returned.
Error handling
Errors are reported as specified in math_errhandling.
If the result of std::lrint or std::llrint is outside the range representable by the
return type, a domain error or a range error may occur.
If the implementation supports IEEE floating-point arithmetic
For the std::rint function:
For std::lrint and std::llrint functions:
Notes
POSIX specifies that all cases where std::lrint or std::llrint raise FE_INEXACT are
domain errors.
As specified in math_errhandling, FE_INEXACT may be
non-IEEE floating-point platforms)
finite value.
The only difference between std::rint and std::nearbyint is that std::nearbyint
never raises FE_INEXACT.
The largest representable floating-point values are exact integers in all standard
floating-point formats, so std::rint never overflows on its own;
may overflow any integer type
variable.
If the current rounding mode is...
Example
// Run this code