Explanation of the ROUND function with NUMERIC as an argument

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: kamiya33hirokazu(at)gmail(dot)com
Subject: Explanation of the ROUND function with NUMERIC as an argument
Date: 2022-12-03 08:54:32
Message-ID: 167005767233.1899.2490889277144246641@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/bug-reporting.html
Description:

I think the manual's description of the round function with numeric as an
argument is different from the actual behavior.

manual
https://www.postgresql.org/docs/15/functions-math.html

Explanation of the manual's ROUND function
round ( numeric ) → numeric
round ( double precision ) → double precision
Rounds to nearest integer. For numeric, ties are broken by rounding away
from zero. For double precision, the tie-breaking behavior is platform
dependent, but “round to nearest even” is the most common rule.
round(42.4) → 42

Operation of the ROUND function
postgres=# SELECT round(CAST(42.5 AS numeric));
round
-------
43
(1 row)

I am thinking that the value of the ROUND function with NUMERIC as an
argument is rounded off, not rounded away from zero.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Laurenz Albe 2022-12-03 13:34:56 Re: Explanation of the ROUND function with NUMERIC as an argument
Previous Message Tom Lane 2022-12-02 23:11:46 Re: Views "missing" from information_schema.view_table_usage