round
Round decimal values to a consistent number of places for prices, measurements or reports.
Try an expression
In Formula, enter the expression and set Output type to DOUBLE.
Example input
- Row 1
amount = 12.346 - Row 2
amount = 8.764 - Row 3
amount = NULL
Expression
round(amount, 2)Result
Row 1: 12.35
Row 2: 8.76
Row 3: NULLThe expression returns DECIMAL(5,2). Formula stores it as DOUBLE in this example. NULL means the value is missing.
Arguments and types
round(x, precision)- x
- Number
- precision
- Number
Supported signatures (16)
round(x: BIGINT) → BIGINT
round(x: BIGINT, precision: INTEGER) → BIGINT
round(x: DECIMAL) → DECIMAL
round(x: DECIMAL, precision: INTEGER) → DECIMAL
round(x: DOUBLE) → DOUBLE
round(x: DOUBLE, precision: INTEGER) → DOUBLE
round(x: FLOAT) → FLOAT
round(x: FLOAT, precision: INTEGER) → FLOAT
round(x: HUGEINT) → HUGEINT
round(x: HUGEINT, precision: INTEGER) → HUGEINT
round(x: INTEGER) → INTEGER
round(x: INTEGER, precision: INTEGER) → INTEGER
round(x: SMALLINT) → SMALLINT
round(x: SMALLINT, precision: INTEGER) → SMALLINT
round(x: TINYINT) → TINYINT
round(x: TINYINT, precision: INTEGER) → TINYINTThe result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
If the first argument is missing, the result is NULL.
Function metadata from DuckDB, used under the MIT license.