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)。