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

double floor ( double x );
float floor ( float x );
long double floor ( long double x );

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

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

    return 0;
}
実行結果
floor(1.500000) = 1.000000





inserted by FC2 system