取小数的常见操作

链接出处:http://yuhaio6oo.blog.163.com/blog/static/8249505620111160231530/

1.丢弃小数部分,保留整数部分 
js:parseInt
2.向上取整,有小数就整数部分加1 
js: Math.ceil  //不小于该小数,包括该整数
3,四舍五入. 
js: Math.round
4,向下取整 
js: Math.floor

你用向上取整,或者 Math.floor() + 1 也行
原文地址:https://www.cnblogs.com/wanlibingfeng/p/9167190.html