ceil函数

ceil函数的作用是求不小于给定实数的最小整数。

ceil(2)=ceil(1.2)=cei(1.5)=2.00


使用该函数需要包含头文件<math.h>,该函数返回值为浮点型


Run-Time Library Referenceceil, ceilfCalculates 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
);

Parameter
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
± QNAN,IND none _DOMAIN

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

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

Requirements
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.

Libraries

All versions of the C run-time libraries.

Example
See the example for floor.

相关文章:

  • 2021-08-09
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-20
  • 2021-09-29
  • 2021-12-10
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案