round, lround, llround

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
roundlroundllround
(C99)(C99)(C99)
(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       roundf( float arg );
(since C99)
double      round( double arg );
(since C99)
long double roundl( long double arg );
(since C99)
long      lroundf( float arg );
(since C99)
long      lround( double arg );
(since C99)
long      lroundl( long double arg );
(since C99)
long long llroundf( float arg );
(since C99)
long long llround( double arg );
(since C99)
long long llroundl( long double arg );
(since C99)

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)
(C99)
nearest integer not greater in magnitude than the given value
(function)
C++ documentation for round