首页 > 其他 > 详细

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

时间:2019-01-17 11:32:19      阅读:153      评论:0      收藏:0      [点我收藏+]

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

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

原文:https://www.cnblogs.com/ZJ199012/p/10281200.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!