> For the complete documentation index, see [llms.txt](https://docs.e6data.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.e6data.com/product-documentation/sql-command-reference/mathematical-functions-and-operators/rounding-and-truncation-functions.md).

# Rounding and Truncation Functions

#### <mark style="color:purple;">CEIL(</mark>  \<expr>  <mark style="color:purple;">)</mark>&#x20;

Returns the smallest integer which is greater than or equal to the specified numerical expression.

```sql
> select ceil(2.34);
3
```

#### <mark style="color:purple;">FLOOR(</mark>  \<expr>  <mark style="color:purple;">)</mark> &#x20;

Returns the largest integer which is less than or equal to the specified numerical expression.

```sql
> select floor(6.34);
6
```

#### <mark style="color:purple;">ROUND(</mark>  \<expr>  \[,  \<scale>  ]  <mark style="color:purple;">)</mark> &#x20;

Returns the numeric value, rounded off to a given number of decimal places, of the input numeric expression. If the scale factor is not specified, it will round off to the nearest integer.

`scale` - optional numeric expression, representing the number of decimal places to be rounded off to in a given numeric expression. Default is 0.

```sql
> select round(5.678);
6
> select round(5.678, 2);
5.68
```

#### <mark style="color:purple;">ABS(</mark>  \<expr>  <mark style="color:purple;">)</mark> &#x20;

Returns the absolute value of the specified numeric expression.

```sql
> select abs(-100);
100
```

#### <mark style="color:purple;">SIGN(</mark>  \<expr>  <mark style="color:purple;">)</mark> &#x20;

The SIGN function returns the sign of its argument:

* Returns -1 if the argument is negative
* Returns 1 if the argument is positive
* Returns 0 if the argument is 0

```sql
> select sign(-100);
-1
```

#### <mark style="color:purple;">MOD(</mark>  \<expr1>, \<expr2>  <mark style="color:purple;">)</mark> &#x20;

Returns the remainder of expression-1 divided by expression-2

Support datatype: INT/DOUBLE

```sql
> select mod(17,3)
2.0
```


---

# 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.e6data.com/product-documentation/sql-command-reference/mathematical-functions-and-operators/rounding-and-truncation-functions.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.
