Reference

round(3)

round to nearest integral value

NAME

round, roundf, roundl – round to nearest integral value

LIBRARY

Math Library (libm, -lm)

SYNOPSIS

#include <math.h>

double

round(double x);

float

roundf(float x);

long double

roundl(long double x);

DESCRIPTION

The round(), roundf(), and roundl() functions return the nearest integral value to x; if x lies halfway between two integral values, then these functions return the integral value with the larger absolute value (i.e., they round away from zero).

SEE ALSO

ceil(3), floor(3), ieee(3), lrint(3), lround(3), math(3), rint(3), trunc(3)

STANDARDS

These functions conform to ISO/IEC 9899:1999 (“ISO C99”).

HISTORY

The round() and roundf() functions appeared in FreeBSD 5.3. The roundl() function appeared in FreeBSD 6.0.

History