> For the complete documentation index, see [llms.txt](https://docs.wem.io/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wem.io/platform/wemreference/functions/math/round.md).

# Round

{% hint style="info" %}
The **`Round()`** function rounds a number.

Rounding a number can be done according to different strategies when it comes to the mid-point cases (like x.5).&#x20;

WEM supports the **Banker's Rounding strategy** as default option because of its statistical superiority and standard use in financial and statistical operations.&#x20;

From Runtime 4.2 an optional strategy parameter is added to this function. It allows 2 keywords, **ToEven** (which is default) and **AwayFromZero**, (new option) that can be set as optional 3rd parameter in the expression if the AwayFromZero strategy is the desired Rounding feature for your application.

Mind, this **only applies to the&#x20;*****Mid-Point*****&#x20;values**: the middle of the spectrum, where a decision needs to be made which way to go. So if you expect 3.85 to be rounded to 3.9 (away from zero), you need to use the AwayFromZero in the expression - the default ToEven will result in 3.8 (Banker's).

Read [this wiki page](https://en.wikipedia.org/wiki/Rounding) about rounding strategies.

This function is NOT SQL compatible. For more information about SQL compatibility, see our [documentation](/platform/wemreference/sql-compatibility.md).
{% endhint %}

{% hint style="success" %}
Returns a number that is rounded to an integral number or a number of fractional digits.\
Returns <mark style="color:red;">**`Invalid expression`**</mark> if one of the parameter values is not a valid number.
{% endhint %}

{% hint style="warning" %}
This function uses 32-bit Integers, therefore the range of valid parameters is

**-2147483648 and +2147483648**
{% endhint %}

### Syntax

<details>

<summary><code>Round(</code><mark style="color:blue;"><code>number</code></mark><code>)</code></summary>

`Round(1.523)`\
\&#xNAN;*=> 2*

`Round()`\
\&#xNAN;*=> Invalid expression*

</details>

<details>

<summary><code>Round(</code><mark style="color:blue;"><code>number, digits</code></mark><code>)</code></summary>

`Round(3.141592, 2)`\
\&#xNAN;*=> 3.14*

`Round()`\
\&#xNAN;*=> Invalid expression*

</details>

<details>

<summary><code>Round(</code><mark style="color:blue;"><code>number, digits, strategy</code></mark><code>) /* Runtime 4.2 only! */</code></summary>

`Round(3.141592, 2, ToEven)`\
\&#xNAN;*=> 3.14*

`Round(3.85, 1, ToEven)`\
\&#xNAN;*=> 3.8*

`Round(3.85, 1, AwayFromZero)`\
\&#xNAN;*=> 3.9*

</details>

### Parameters

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="150" align="center">Required</th><th width="248.15953250810662">Description</th><th data-hidden>Required?</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>number</code></mark></td><td>numeric</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2611">☑️</span></td><td>a number</td><td>yes</td></tr><tr><td><mark style="color:blue;"><code>digits</code></mark></td><td>numeric</td><td align="center"></td><td>the number of fractional digits <mark style="color:blue;"><code>number</code></mark> is rounded.</td><td>yes</td></tr><tr><td><mark style="color:blue;"><code>strategy</code></mark></td><td>keyword</td><td align="center"></td><td><code>ToEven</code> (default) or <code>AwayFromZero</code><br><em>(Runtime 4.2 only!)</em></td><td></td></tr></tbody></table>

### Examples

| Function call                  | Result                                                                     |
| ------------------------------ | -------------------------------------------------------------------------- |
| Round(5.499)                   | 5                                                                          |
| Round(5.501)                   | 6                                                                          |
| Round(3.85, 1)                 | 3.8                                                                        |
| Round(5.489, 2)                | 5.49                                                                       |
| Round(5.499, 2)                | 5.50                                                                       |
| Round(3.85, 1)                 | 3.8                                                                        |
| Round(3.85, 1, `ToEven`)       | <p>3.8 in Runtime 4.2<br><em>invalid expression in older runtimes</em></p> |
| Round(3.85, 1, `AwayFromZero`) | <p>3.9 in Runtime 4.2<br><em>invalid expression in older runtimes</em></p> |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.wem.io/platform/wemreference/functions/math/round.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
