Doc: document the tie-breaking behavior of the round() function.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Apr 2021 18:47:26 +0000 (14:47 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Apr 2021 18:47:26 +0000 (14:47 -0400)
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

doc/src/sgml/func.sgml

index d20116340752705e0276dbc3e00958d68e181a8f..5bba13973f3d1bdb73f016b03e7b1d236f4b8a94 100644 (file)
@@ -1568,7 +1568,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
         <returnvalue>double precision</returnvalue>
        </para>
        <para>
-        Rounds to nearest integer
+        Rounds to nearest integer.  For <type>numeric</type>, ties are
+        broken by rounding away from zero.  For <type>double precision</type>,
+        the tie-breaking behavior is platform dependent, but
+        <quote>round to nearest even</quote> is the most common rule.
        </para>
        <para>
         <literal>round(42.4)</literal>
@@ -1583,7 +1586,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
        </para>
        <para>
         Rounds <parameter>v</parameter> to <parameter>s</parameter> decimal
-        places
+        places.  Ties are broken by rounding away from zero.
        </para>
        <para>
         <literal>round(42.4382, 2)</literal>