標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C |
両方 |
#include <math.h>
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);
計算値を double、浮動、または long double の値として戻します。
オーバーフローが起こると、関数は errno に ERANGE を設定し、HUGE_VAL を 戻します。
IEEE の特殊な動作: ceil() 関数は、常に正常に実行されます。
⁄* CELEBC04
This example sets y to the smallest integer greater than
1.05, and then to the smallest integer greater than -1.05.
The results are 2.0 and -1.0, respectively.
*⁄
#include <math.h>
#include <stdio.h>
int main(void)
{
double y, z;
y = ceil(1.05); ⁄* y = 2.0 *⁄
z = ceil(-1.05); ⁄* z = -1.0 *⁄
printf("y = %f¥n z = %f¥n", y, z);
}