Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ceil, ceilf
Collapse the table of content
Expand the table of content

ceil, ceilf

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


Floating-point value.

Return Value

The ceil function returns a double value representing the smallest integer that is greater than or equal to x. There is no error return.

Input SEH Exception Matherr Exception

ceil has an implementation that uses Streaming SIMD Extensions 2 (SSE2). See _set_SSE2_enable for information and restrictions on using the SSE2 implementation.


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


Routine Required header Compatibility
ceil, ceilf <math.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.


See the example for floor.

See Also

Floating-Point Support Routines | floor | fmod | Run-Time Routines and .NET Framework Equivalents

© 2015 Microsoft