java Math.ceil Math.floor

Math.ceil 獲得不小於某數的最大整數
Math.floor 獲得不大於某數的最大整數code

例如:Math.floor(12.7) =12.0co

Math.ceil(12.7) =13.0

ceil()是天花板,即向上取整。floor是地板,向下取整。round是四捨五入。

相關文章
相關標籤/搜索