0001-Document-tie-breaking-behavior-of-round.v2.patch
text/x-patch
Filename: 0001-Document-tie-breaking-behavior-of-round.v2.patch
Type: text/x-patch
Part: 0
Message:
Re: Rounding strategy
Patch
Format: format-patch
Series: patch v2-0001
Subject: Document tie breaking behavior of round()
| File | + | − |
|---|---|---|
| doc/src/sgml/func.sgml | 6 | 2 |
From 7881d8a73f6cf93c21a9d1405736c6ce6cff5429 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@cybertec.at>
Date: Fri, 23 Apr 2021 09:38:27 +0200
Subject: [PATCH] Document tie breaking behavior of round()
---
doc/src/sgml/func.sgml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 67d802b02c..9ed39dabfd 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1568,7 +1568,11 @@ 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 0. For <type>double precision</type>,
+ the tie breaking behavior is architecture dependent, but
+ <quote>round to nearest even</quote> in accordance with IEEE-754
+ is the most common rule.
</para>
<para>
<literal>round(42.4)</literal>
@@ -1583,7 +1587,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 0.
</para>
<para>
<literal>round(42.4382, 2)</literal>
--
2.26.3