std::round, std::lround, std::llround
From Cppreference
C++ Standard Library | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Numerics library | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Common mathematical functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <cmath>
|
||
float round( float arg );
|
(since C++11) | |
double round( double arg );
|
(since C++11) | |
long double round( long double arg );
|
(since C++11) | |
double round( Integral arg );
|
(since C++11) | |
long lround( float arg );
|
(since C++11) | |
long lround( double arg );
|
(since C++11) | |
long lround( long double arg );
|
(since C++11) | |
long lround( Integral arg );
|
(since C++11) | |
long long llround( float arg );
|
(since C++11) | |
long long llround( double arg );
|
(since C++11) | |
long long llround( long double arg );
|
(since C++11) | |
long long llround( Integral arg );
|
(since C++11) | |
Computes nearest integer to arg. Number is rounded away from zero in halfway cases
[edit] Parameters
arg | - | floating point value |
[edit] Return value
nearest integer to arg.
[edit] See also
nearest integer not greater than the given value (function) |
|
nearest integer not less than the given value (function) |
|
(C++11)
|
nearest integer not greater in magnitude than the given value (function) |