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

22 lines
681 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Math Ceil
localeTitle: 数学Ceil
---
## 数学Ceil
`Math.ceil()`是Math标准对象的一种方法它将给定数字向上舍入到下一个整数。请注意对于负数这意味着该数字将被“舍入为0”而不是更大的绝对值数参见示例
### 例子
```javascript
Math.ceil(0.1) // 1
Math.ceil(1.3) // 2
Math.ceil(-0.9) // -0
Math.ceil(-1.5) // -1
```
### 更多信息:
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil)
* [W3Schools的](https://www.w3schools.com/jsref/jsref_ceil.asp)
* [维基百科](https://en.wikipedia.org/wiki/Floor_and_ceiling_functions)