# Round Number

> Round a number using a chosen method (round, floor, ceil, truncate) to a specified number of digits.

- ID: `round_number`
- Type: Block
- Category: [Math](https://inventor.bot/docs/reference/blocks/math.md)

- Value block: it can be used directly inside expressions, e.g. `"Result: " + round_number(Args{...})`.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `number` | yes | Number to round. | e.g. `"3.14159"` |
| `mode` | yes | Rounding method to use. | `"Round"`, `"Floor"`, `"Ceil"`, `"Truncate"` |
| `digits` | yes | Number of digits to round to. Positive for decimals, negative for tens/hundreds/etc. E.g. 1 → 3.1, 0 → 3, -1 → 1250. | e.g. `"0"` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `result` | Rounded number. | e.g. `"3"` |

**Example**

```go
roundNumber := round_number(Args{
	number: 3.14159,
	mode:   "Round",
	digits: 0,
})
send_text_message(Args{channel_id: trigger.channel_id, message_content: "Result: " + roundNumber})
```