freeCodeCamp/guide/chinese/javascript/standard-objects/math/math-ceil/index.md

681 B
Raw Blame History

title localeTitle
Math Ceil 数学Ceil

数学Ceil

Math.ceil()是Math标准对象的一种方法它将给定数字向上舍入到下一个整数。请注意对于负数这意味着该数字将被“舍入为0”而不是更大的绝对值数参见示例

例子

Math.ceil(0.1)  //  1 
 Math.ceil(1.3)  //  2 
 Math.ceil(-0.9) // -0 
 Math.ceil(-1.5) // -1 

更多信息: