[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


ceil

Compute the smallest floating point number not less than x.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <math.h>

double ceil(double x);
float ceilf(float);
long double ceill(long double);
Parameters:

Parameters for this function are:

x  
float, double or long double  
value to be computed  

Return:

ceil() returns the smallest integer not less than x.

See Also:

"floor"

"fmod"

"round"

Example of ceil() usage.:
#include <math.h>
#include <stdio.h>

int main(void)
{
	double x = 100.001, y = 9.99;

	printf("The ceiling of %f is %f.\n", x, ceil(x));
	printf("The ceiling of %f is %f.\n", y, ceil(y));

	return 0;
}

Output:
The ceiling of 100.001000 is 101.000000.
The ceiling of 9.990000 is 10.000000.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000