ceil
double  ceil ( double x );
math.h
  cplusplus.com  

Round up a value.
  Returns the smallest integer that is greater or equal to x

Parameters.

x
Floating point value

Return Value.
  Ceiling of x.

Portability.
  Defined in ANSI-C.
  ANSI-C++ adds float and double overloaded versions of this function, with the same bahavior but being both, parameter and result, of one of these types.

Example.

/* ceil example */
#include <stdio.h>
#include <math.h>

main ()
{
  printf ("ceil of 2.3 is %.1lf\n", ceil (2.3) );
  printf ("ceil of 3.8 is %.1lf\n", ceil (3.8) );
  printf ("ceil of -2.3 is %.1lf\n", ceil (-2.3) );
  printf ("ceil of -3.8 is %.1lf\n", ceil (-3.8) );
  return 0;
}
Output:
ceil of 2.3 is 3.0
ceil of 3.8 is 4.0
ceil of -2.3 is -2.0
ceil of -3.8 is -3.0

See also.
  floor, fmod


© The C++ Resources Network, 2000