Round to smallest integral value not less than x
View other versions (3)
Contents  |
|
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 1:
#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;
}
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 ±∞.
See Also
abs,
fabs,
floorStandards
The
ceil function conform to ISO/IEC 9899:1999(E).
Last Modified: 2009-11-01 08:46:02 Page Rendered: 2010-03-10 09:55:12