Skip to main content
Rounds a value to a specified number of decimal places.

Syntax

Parameters

Return Types

DOUBLE PRECISION

Rounding behavior

When rounding values that are exactly halfway between two possible results (for example, 1.5 or 2.5 when rounding to the nearest integer), ROUND uses different strategies depending on the data type:
  • DOUBLE PRECISION: Uses banker’s rounding (also called round half to even). Ties are rounded to the nearest even number. For example, both 1.5 and 2.5 round to 2 (the nearest even number).
  • NUMERIC: Uses standard rounding (round half up). Ties are always rounded up. For example, 1.5 rounds to 2 and 2.5 rounds to 3.
This behavior ensures that when working with floating point numbers, rounding errors don’t accumulate in a particular direction over many operations.

Example

The following example returns the rounded value of 5.4. Since there is no specification of the decimal range, the functions returns a whole number:

Rows: 1Execution time: 7.16ms

The following example rounds the value 5.6930 to 1 decimal place:

Rows: 1Execution time: 5.46ms

The following examples demonstrate the tie-breaking behavior for values exactly halfway between two results:

Rows: 1Execution time: 5.73ms

Notice how both 1.5 and 2.5 round to 2 (the nearest even number). This is banker’s rounding behavior for DOUBLE PRECISION types. With NUMERIC types, ties round up instead:

Rows: 1Execution time: 5.45ms

The same tie-breaking behavior applies when rounding to a specific number of decimal places:

Rows: 1Execution time: 5.43ms

Both 1.15 and 1.25 round to 1.2 when rounding to 1 decimal place, demonstrating banker’s rounding. With NUMERIC types at a specific decimal precision:

Rows: 1Execution time: 10.61ms