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

Definition

#include <math.h>

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

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

Example

#include <math.h>
#include <stdio.h>
int main(void)
{  double x;   printf("Please enter the floating-point number to be rounded up:\n");
   if (scanf("%lf", &x) == 1)       printf("The number %g is being rounded up to %f\n", x, ceil(x));
   return 0;
}

See also

abs, fabs, floor