Name

ceil, ceilf, ceill
- ceiling function: smallest integral value not less than argument

Library

libm.lib

Synopsis

  #include <math.h>
  double ceil (double x);
  float ceilf (float x);
  long double ceill (long double x);

Return values

x is integral or infinite, x itself is returned.


Detailed description

The ceil, ceilf, and ceill functions return the smallest integral value greater than or equal to x, expressed as a floating-point number.

Examples

#include <math.h>
int main( void )
{
   double y;
   y = ceil( 2.8 );
   printf( "The ceil of 2.8 is %f\n", y );
   y = ceil( -2.8 );
   printf( "The ceil of -2.8 is %f\n", y );
   y = ceilf( 2.8 );
   printf( "The ceilf of 2.8 is %f\n", y );
   y = ceilf( -2.8 );
   printf( "The ceilf of -2.8 is %f\n", y );
   y = ceill( 2.8 );
   printf( "The ceill of 2.8 is %f\n", y );
   y = ceill( -2.8 );
   printf( "The ceill of -2.8 is %f\n", y );
}

         

Output

The ceil of 2.8 is 3.000000
The ceil of -2.8 is -2.000000
The ceilf of 2.8 is 3.000000
The ceilf of -2.8 is -2.000000
The ceill of 2.8 is 3.000000
The ceill of -2.8 is -2.000000

         


See also

abs, fabs, floor, ieee, math, rint, round, and trunc

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top