圓()在C+中浮動我需要一個簡單的浮點舍入函數,因此:double round(double);round(0.1) = 0round(-0.1) = 0round(-0.9) = -1我能找到ceil()和floor()在數學里.但是.round().它是以另一個名稱出現在標準C+庫中,還是丟失了?
3 回答
BIG陽
TA貢獻1859條經驗 獲得超6個贊
#include <boost/math/special_functions/round.hpp>double a = boost::math::round(1.5); // Yields 2.0int b = boost::math::iround(1.5); // Yields 2 as an integer
編輯std::round, std::lroundstd::llround.
- 3 回答
- 0 關注
- 573 瀏覽
添加回答
舉報
0/150
提交
取消
