ceil

Computes the smallest integer not less than x

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Mathematical Computation

Syntax

  #include <math.h>  
   
  double ceil  (  
     double   x);
  

Parameters

x
(IN) Specifies an argument.

Return Values

The ceil function returns the smallest integer not less than x, expressed as a double type.

Remarks

The ceil function (ceiling function) computes the smallest integer not less than x :

  (ceil (x) ::= -floor (-x))
  

See Also

floor

Example

  #include <math.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     printf ("%f %f %f %f %f\n", ceil (-2.1), ceil (-2.),  
     ceil (0.0), ceil (2.), ceil (2.1) );  
  }
  

produces the following:

  -2.000000 -2.000000 0.000000 2.000000 3.000000