ceil()

Rounds a number up to the closest whole number.

  #include <math.h>
  
  double ceil(double x);
  
  float ceilf(float x);
  
  long double ceill(long double x);    
Parameter

x

A number to round up.

Remarks

These functions return the smallest integer that is not less than x.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of ceil() usage

#include <math.h>

#include <stdio.h>

int main(void)

{

double x = 100.001, y = 9.99;

printf("The ceiling of %f is %f.\n", x, ceil(x));

printf("The ceiling of %f is %f.\n", y, ceil(y));

return 0;

}

Output:

The ceiling of 100.001000 is 101.000000.

The ceiling of 9.990000 is 10.000000.