Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

ceil, ceilf, ceill - round up floating-point number

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

double ceil(double x);
float ceilf(float x);
long double ceill(long double x);

Description

These functions round up a floating-point number to an integer value.

Return val.

Lowest integer in floating point format which is greater than or equal to x.

Note

The integer value returned by ceil(), ceilf() and ceill() as double, float or long
double cannot always be represented as int or long int. The result should always be checked before it is assigned to a variable of type int, so that an integer overflow can be caught.

To make sure that any errors are caught, errno should be set to 0 before ceil(),
ceilf() or ceill() is called. If after the execution errno != 0, an error has occurred.

See also

abs(), fabs(), floor(), floorf(), floorl(), isnan(), math.h.