ceil() Mathematics Function ceil() Set numeric ceiling #include <math.h> double ceil(z) double z; ceil returns a double-precision floating point number whose value is the smallest integer greater than or equal to z. ***** Example ***** The following example demonstrates how to use ceil: #include <math.h> #include <stdio.h> #define display(x) dodisplay((double)(x), #x) dodisplay(value, name) double value; char *name; { if (errno) perror(name); else printf("%10g %s\n", value, name); errno = 0; } main() { extern char *gets(); double x; char string[64]; for (;;) { printf("Enter number: "); if (gets(string) == NULL) break; x = atof(string); display(x); display(ceil(x)); display(floor(x)); display(fabs(x)); display(sqrt(x)); } putchar('\n'); COHERENT Lexicon Page 1
ceil() Mathematics Function ceil() } ***** See Also ***** abs(), fabs(), floor(), frexp(), mathematics library COHERENT Lexicon Page 2