We recommend using Visual Studio 2017

ceil, ceilf, ceill


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at ceil, ceilf, ceill.

Calculates the ceiling of a value.

double ceil(   
   double x   
float ceil(  
   float x  
);  // C++ only  
long double ceil(  
   long double x  
);  // C++ only  
float ceilf(  
   float x  
long double ceill(  
   long double x  


Floating-point value.

The ceil functions return a floating-point value that represents the smallest integer that is greater than or equal to x. There is no error return.

InputSEH ExceptionMatherr Exception

ceil has an implementation that uses Streaming SIMD Extensions 2 (SSE2). For information and restrictions about using the SSE2 implementation, see _set_SSE2_enable.

Because C++ allows overloading, you can call overloads of ceil. In a C program, ceil always takes and returns a double.

RoutineRequired header
ceil, ceilf, ceill<math.h>

For additional compatibility information, see Compatibility.

See the example for floor.


Floating-Point Support
floor, floorf, floorl
fmod, fmodf
round, roundf, roundl