Math.round、Math.floor、Math.ceil 区别

1、Math.round() 按照四舍五入的方式返回值

例如:Math.round(9.5)=10

     Math.round(9.4)=9

2、Math.floor()返回最小整数

例如:Math.floor(9.5)=9

   Math.floor(9.2)=9

3、Math.ceil()返回最大整数

例如: Math.ceil(9.1)=10

      Math.ceil(9.5)=10

posted on 2019-01-17 11:13  lovezj9012  阅读(195)  评论(0编辑  收藏  举报

导航