I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
ComputingCMath.h

ceill

Round to smallest integral value not less than x
+ View other versions (5)

Interface

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

Description

The ceil function returns the smallest integral value greater than or equal to x.

Example:
Example - Round to smallest integral value not less than x
Workings
#include <stdio.h>
#include <math.h>
int main(void)
{
  for(double a = 12; a < 13; a += 0.1)
    printf("ceil of  %.1lf is  %.1lf\n", a, ceil(a));
  return 0;
}
Solution
Output
ceil of  12.0 is  12.0
ceil of  12.1 is  13.0
ceil of  12.2 is  13.0
ceil of  12.3 is  13.0
ceil of  12.4 is  13.0
ceil of  12.5 is  13.0
ceil of  12.6 is  13.0
ceil of  12.7 is  13.0
ceil of  12.8 is  13.0
ceil of  12.9 is  13.0
ceil of  13.0 is  13.0

Special Values

ceil ( ±0 ) returns ±0.

ceil ( ±&infin ) returns ±∞.

Standards

The ceil function conform to ISO/IEC 9899:1999(E).