Skip to content

Commit 82b13db

Browse files
committed
Doc: document the tie-breaking behavior of the round() function.
Back-patch to v13; the table layout in older branches is unfriendly to adding such details. Laurenz Albe Discussion: https://postgr.es/m/[email protected]
1 parent 4c4eaf3 commit 82b13db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/src/sgml/func.sgml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
15681568
<returnvalue>double precision</returnvalue>
15691569
</para>
15701570
<para>
1571-
Rounds to nearest integer
1571+
Rounds to nearest integer. For <type>numeric</type>, ties are
1572+
broken by rounding away from zero. For <type>double precision</type>,
1573+
the tie-breaking behavior is platform dependent, but
1574+
<quote>round to nearest even</quote> is the most common rule.
15721575
</para>
15731576
<para>
15741577
<literal>round(42.4)</literal>
@@ -1583,7 +1586,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
15831586
</para>
15841587
<para>
15851588
Rounds <parameter>v</parameter> to <parameter>s</parameter> decimal
1586-
places
1589+
places. Ties are broken by rounding away from zero.
15871590
</para>
15881591
<para>
15891592
<literal>round(42.4382, 2)</literal>

0 commit comments

Comments
 (0)