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/161881920775.685.12293798764864559341@wrigleys.postgresql.org
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

Lines changed: 5 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy