跳轉到內容

C++ 程式設計/程式碼/標準 C 庫/函式/floor

華夏公益教科書,自由的教學讀本
語法
#include <cmath>
double floor( double arg );

floor() 函式返回不大於 arg 的最大整數。

// Example for positive numbers
y = 6.04;
x = floor( y );

將導致 x 被設定為 6(雙精度浮點數 6.0)。

// Example for negative numbers
y = -6.04;
x = floor( y );

將導致 x 被設定為 -7(雙精度浮點數 -7.0)。

相關主題
ceil - fmod
華夏公益教科書