NEARBYINT(3)

NAME
nearbyint, ceil, floor, trunc - floating point rounding

SYNOPSIS
#include <math.h>
double ceil(double x);
double floor(double x);
double nearbyint(double x);
double trunc(double x);

DESCRIPTION
These functions round the specified floating point number to a nearby integer. For nearbyint, the rounding mode is determined by the value set using the fesetround function. The other functions are not influenced by the rounding mode. The ceil function rounds upwards, selecting the smallest integer that is larger than or equal to x. The floor function rounds downwards, selecting the largest integer that is smaller than or equal to x. The trunc function rounds towards zero, selecting the largest integer with the largest absolute value of which the absolute value is smaller than or equal to the absolute value of x.

RETURN VALUE
The functions return an integer close to x.

SEE ALSO
fesetround(3)