Skip to content

Latest commit

 

History

History
79 lines (59 loc) · 2.54 KB

ceil-ceilf-ceill.md

File metadata and controls

79 lines (59 loc) · 2.54 KB
title description ms.date api_name api_location api_type topic_type f1_keywords helpviewer_keywords ms.assetid
ceil, ceilf, ceill
API ref for calculating the ceiling of a value with ceil().
9/1/2020
ceilf
ceil
ceill
_o_ceil
_o_ceilf
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
ntdll.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
apiref
ceil
ceilf
ceill
calculating value ceilings
ceill function
ceil function
ceilf function
f4e5acab-5c8f-4b10-9ae2-9561e6453718

ceil, ceilf, ceill

Calculates the ceiling of a value.

Syntax

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
);
#define ceil(X) // Requires C11 or higher

Parameters

x
Floating-point value.

Return value

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

Input SEH exception _matherr exception
± QNaN, IND none _DOMAIN

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

Remarks

Because C++ allows overloading, you can call overloads of ceil that take float or long double types. In a C program, unless you're using the <tgmath.h> macro to call this function, ceil always takes and returns a double.

If you use the <tgmath.h> ceil() macro, the type of the argument determines which version of the function is selected. See Type-generic math for details.

By default, this function's global state is scoped to the application. To change this state, see Global state in the CRT.

Requirements

Routine Required header
ceil, ceilf, ceill <math.h>
ceil macro <tgmath.h>

For more compatibility information, see Compatibility.

Example

See the example for floor.

See also

Math and floating-point support
floor, floorf, floorl
fmod, fmodf
round, roundf, roundl