トップページ > キーワード検索 > ceil()
C言語規格
C言語(その他)
プログラム
その他
ceil()
機能 x以上の最小の整数値(切上げ値)を計算することを表す。
定義 #include <math.h>

double ceil ( double x );
float ceil ( float x );
long double ceil ( long double x );

※C99規格では以下の定義となる
double ceil ( double x );
float ceilf ( float x );
long double ceill ( long double x );
引数
x計算する値
戻り値 計算結果を返す。
実装例
#include <math.h>
#include <stdio.h>

int main(void)
{
    double a = 1.5;
    
    printf("ceil(%f) = %f\n", a, ceil(a) );

    return 0;
}
実行結果
ceil(1.500000) = 2.000000





inserted by FC2 system