Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 00037d8

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/161881920775.685.12293798764864559341@wrigleys.postgresql.org
1 parent a71cfc5 commit 00037d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/src/sgml/func.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
16171617
<returnvalue>double precision</returnvalue>
16181618
</para>
16191619
<para>
1620-
Rounds to nearest integer
1620+
Rounds to nearest integer. For <type>numeric</type>, ties are
1621+
broken by rounding away from zero. For <type>double precision</type>,
1622+
the tie-breaking behavior is platform dependent, but
1623+
<quote>round to nearest even</quote> is the most common rule.
16211624
</para>
16221625
<para>
16231626
<literal>round(42.4)</literal>
@@ -1632,7 +1635,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
16321635
</para>
16331636
<para>
16341637
Rounds <parameter>v</parameter> to <parameter>s</parameter> decimal
1635-
places
1638+
places. Ties are broken by rounding away from zero.
16361639
</para>
16371640
<para>
16381641
<literal>round(42.4382, 2)</literal>

0 commit comments

Comments
 (0)