Java Math的 floor,round和ceil的總結

floor 返回不大於的最大整數 round 則是4舍5入的計算,入的時候是到大於它的整數 round方法,它表示「四捨五入」,算法爲Math.floor(x+0.5),即將原來的數字加上0.5後再向下取整,因此,Math.round(11.5)的結果爲12,Math.round(-11.5)的結果爲-11。 ceil 則是不小於他的最小整數 算法 看例子table   Math.floor Ma
相關文章
相關標籤/搜索