COHERENT manpages
This page displays the COHERENT manpage for ceil() [Set numeric ceiling].
List of available manpages
Index
ceil() -- Mathematics Function (libm) 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 <errno.h> #include <math.h> #include <stdio.h> #include <stdlib.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)); } putchar('\n'); } See Also abs(), fabs(), floor(), frexp(), libm ANSI Standard §7.5.6.1 POSIX Standard, §8.1