c99 開始有 round() 函式處理 四舍5入。函式原型:double round (double x);float roundf (float x);long double roundl (long double x);C++11 有 double round (T x); ----低於c99 的可以自己寫,例如: 絕對值+0.5, 絕對值函式原型:double fabs (double x);float fabs (float x);long double fabs (long double x);正數和負數的 四舍5入 有天花板和地板的 處理,由你自己選擇(上靠,下靠) 。天花板和地板函式原型:double ceil (double x);float ceil (float x);long double ceil (long double x);double floor (double x);float floor (float x);long double floor (long double x);
c99 開始有 round() 函式處理 四舍5入。函式原型:double round (double x);float roundf (float x);long double roundl (long double x);C++11 有 double round (T x); ----低於c99 的可以自己寫,例如: 絕對值+0.5, 絕對值函式原型:double fabs (double x);float fabs (float x);long double fabs (long double x);正數和負數的 四舍5入 有天花板和地板的 處理,由你自己選擇(上靠,下靠) 。天花板和地板函式原型:double ceil (double x);float ceil (float x);long double ceil (long double x);double floor (double x);float floor (float x);long double floor (long double x);