double ceil (double x);
double ceil (double x); float ceilf (float x);long double ceill (long double x);
double ceil (double x); float ceil (float x);long double ceil (long double x);
double ceil (double x); float ceil (float x);long double ceil (long double x); double ceil (T x); // additional overloads for integral types
<cmath> ) for the integral types: These overloads effectively cast x to a double before calculations (defined for T being any integral type ).1
2
3
4
5
6
7
8
9
10
11
12
/* ceil example */
#include <stdio.h> /* printf */
#include <math.h> /* ceil */
int main ()
{
printf ( "ceil of 2.3 is %.1f\n", ceil(2.3) );
printf ( "ceil of 3.8 is %.1f\n", ceil(3.8) );
printf ( "ceil of -2.3 is %.1f\n", ceil(-2.3) );
printf ( "ceil of -3.8 is %.1f\n", ceil(-3.8) );
return 0;
}
ceil of 2.3 is 3.0 ceil of 3.8 is 4.0 ceil of -2.3 is -2.0 ceil of -3.8 is -3.0