首页 > 其他 > 详细

Math中的floor,round和ceil方法总结

时间:2017-01-22 16:56:32      阅读:208      评论:0      收藏:0      [点我收藏+]

floor向下取整,返回不大于的最大整数  Math.floor(1.4)=1.0
ceil向上取整,返回不小于的最小整数  Math.ceil(1.4)=2.0
round 四舍五入,将原来的数字加入0.5后再向下取整
Math.round(-1.4)=-1   Math.round(-1.5)=-1  Math.round(-1.6)=-2

Math中的floor,round和ceil方法总结

原文:http://www.cnblogs.com/zhaobao1830/p/6340495.html

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