.TH ceil() "" "" "Mathematics Function (libm)"
.PC "Set numeric ceiling"
.B "#include <math.h>"
\fBdouble ceil(\fIz\^\fB) double \fIz\^\fB;\fR
.PP
.B ceil()
returns a double-precision
floating-point number whose value is the smallest integer greater than
or equal to
.IR z .
.SH Example
The following example demonstrates how to use
.BR ceil() :
.DM
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define display(x) dodisplay((double)(x), #x)
.DE
.DM
dodisplay(value, name)
double value; char *name;
{
	if (errno)
		perror(name);
	else
		printf("%10g %s\en", value, name);
	errno = 0;
}
.DE
.DM
main()
{
	extern char *gets();
	double x;
	char string[64];
.DE
.DM
	for (;;) {
		printf("Enter number: ");
		if (gets(string) == NULL)
			break;
		x = atof(string);
.DE
.DM
		display(x);
		display(ceil(x));
		display(floor(x));
		display(fabs(x));
	}
	putchar('\en');
}
.DE
.SH "See Also"
.Xr "abs()," abs
.Xr "fabs()," fabs
.Xr "floor()," floor
.Xr "frexp()," frexp
.Xr "libm" libm
.br
\*(AS \(sc7.5.6.1
.br
\*(PX, \(sc8.1
