std::round, std::lround, std::llround

From Cppreference

Jump to: navigation, search
Defined in header <cmath>

int round( float arg );
(C++11 feature)
int round( double arg );
(C++11 feature)
int round( long double arg );
(C++11 feature)
long lround( float arg );
(C++11 feature)
long lround( double arg );
(C++11 feature)
long lround( long double arg );
(C++11 feature)
long long llround( float arg );
(C++11 feature)
long long llround( double arg );
(C++11 feature)
long long llround( long double arg );
(C++11 feature)

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

floor
nearest integer not greater than the given value
(function)
ceil
nearest integer not less than the given value
(function)
trunc (C++11)
nearest integer not greater in magnitude than the given value
(function)