> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ROUND

> Rounds a number to the requested decimal position, resolving halfway values away from zero.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

Returns NULL when value or an explicitly provided decimal\_places is NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
round(value[, decimal_places])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s) | Yes | The number to round. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |
| decimal\_places | INTEGER | No | Digits after the decimal point; negative values round to positions before it. Default: 0. |

## Returns

* Type: FLOAT for FLOAT input; DOUBLE for other nondecimal input; DECIMAL with adjusted precision and scale for decimal input
* Possible values: The number rounded to decimal\_places digits.
* NULL behavior: Returns NULL when value or an explicitly provided decimal\_places is NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Partial (Decimal rounding uses integer arithmetic; floating-point values can incur binary rounding or intermediate precision effects.) |

* Approximation bound: No fixed bound is declared for floating-point rounding.

## Usage notes

* The optional decimal\_places argument defaults to zero and need not be a constant.
* For a decimal value and literal nonnegative decimal\_places, the output scale is the smaller of the input scale and decimal\_places. Negative positions use output scale zero.
* For an integer-scale decimal rounded at a negative position, precision can increase by one, up to the decimal type maximum.
* For a decimal value and nonliteral decimal\_places, the result retains its input scale and may gain one precision digit to accommodate a carry.
* Floating-point inputs multiply by 10^decimal\_places, round and divide back, so binary representation and intermediate overflow/underflow can affect extreme cases.
* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.

## Examples

### Normal values and NULL behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT round(CAST(2.5 AS DOUBLE)) AS positive_half, round(CAST(-2.5 AS DOUBLE)) AS negative_half, round(CAST(123.45 AS DOUBLE), -1) AS tens, round(CAST(NULL AS DOUBLE)) AS null_value;
```

| positive\_half | negative\_half | tens | null\_value |
| - | - | - | - |
| 3 | -3 | 120 | NULL |

### Decimal places and trailing digits

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
WITH sample AS (
  SELECT id, CASE WHEN id = 0 THEN CAST(12.345 AS DECIMAL(8,3)) ELSE CAST(12.344 AS DECIMAL(8,3)) END AS amount
  FROM range(0, 2)
)
SELECT amount, round(amount, 2) AS rounded FROM sample ORDER BY id;
```

| amount | rounded |
| - | - |
| 12.345 | 12.35 |
| 12.344 | 12.34 |

## Limitations

* Decimal precision overflow and unsupported out-of-range decimal\_places can raise an execution error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.