ROUND
All functions > MATH > ROUND
Returns the number rounded to the nearest integer or to a specified number of decimal places.
Signatures
Returns: Rounded number
ROUND(number: T, [decimal_places: BIGINT]) → DOUBLE sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number | T | Yes | The number to round |
decimal_places | BIGINT | No | Optional number of decimal places (default: 0) |
Notes
- Uses "round half up" strategy (0.5 rounds up to 1)
- Negative decimal_places rounds to tens, hundreds, etc.
ROUND(123.456, 2) = 123.46ROUND(123.456, -1) = 120.0- Returns NULL if the input is NULL
Examples
FeatureQL
SELECT
f1 := ROUND(2.4e0), -- Round down below 0.5
f2 := ROUND(2.5e0), -- Round half up
f3 := ROUND(2.6e0), -- Round up above 0.5
f4 := ROUND(-2.4e0), -- Negative number rounds down
f5 := ROUND(-2.6e0), -- Negative number rounds up
f6 := ROUND(123.456e0, 2) -- Round to 2 decimal places
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR | f4 VARCHAR | f5 VARCHAR | f6 VARCHAR |
|---|---|---|---|---|---|
| 2.0 | 3.0 | 3.0 | -2.0 | -3.0 | 123.46 |
On this page