# 四舍五入

指定答案需要四舍五入的小数位数。这将覆盖该行的默认精度设置。

```
# 四舍五入到特定的小数位数
1/3 到 2 位小数                     | 0.33
π 到 5 位数字                   | 3.14159

# 四舍五入向上和向下
5.5 四舍五入                     | 6
5.5 向下取整                | 5
5.5 向上取整                  | 6

# 四舍五入到最近的 x
37 到最近的 10                | 40
$490 四舍五入到最近的百 | $500
2,100 到最近的千       | 2,000

# 四舍五入到最近的 x 的向上和向下
21 向上取整到最近的 5      | 25
17 向下取整到最近的 3    | 15
```

或者使用以下函数之一：

| Function | Name   | Behaviour      |
| -------- | ------ | -------------- |
| round()  | 整数四舍五入 | 将数字四舍五入到最接近的整数 |
| ceil()   | 天花板函数  | 将数字向上取整到最接近的整数 |
| floor()  | 地板函数   | 将数字向下取整到最接近的整数 |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.soulver.app/zh/yu-fa-can-kao/general/number-rounding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
