三个与取整有关的方法

Math.ceil():表示向上取整;Math.ceil(11.3)=12;Math.ceil(-11.3)=-12。

Math.floor():表示向下取整;Math.floor(11.6)=11;Math.floor(-11.6)=-12。

Math.round():表示四舍五入;Math.round(11.5)=12;Math.round(-11.5)=-11;

posted @ 2021-03-09 13:59  又回到了起点  阅读(143)  评论(0编辑  收藏  举报