Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

round, roundf, roundl - Round off to nearest whole number

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double round(double x);

float roundf (float x);

long double roundl (long double x);

Each of the functions returns the whole number nearest to x, in floating point representation.
round represents the result as a number of type double, roundf as a number of type
float, and roundl as a number of type long double.

The return value is independent of the defined rounding mode. If the difference between x
and the rounded result is exactly 0.5, the larger whole number is returned.

Return val.

integer

represented as a number of type double, float or long double
if successful.

undefined

in the event of an overflow or underflow, errno is set to ERANGE to indicate
the error.

See also

abs, ceil, floor, llrint, llround, lrint, lround, rint