pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: kamiya33hirokazu@gmail.com
Subject: Explanation of the ROUND function with NUMERIC as an argument
Date: Sat, 03 Dec 2022 08:54:32 +0000
Message-ID: <167005767233.1899.2490889277144246641@wrigleys.postgresql.org> (raw)

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.


view thread (4+ messages)  latest in thread

Message-ID: <167005767233.1899.2490889277144246641@wrigleys.postgresql.org>
Permalink:  ../167005767233.1899.2490889277144246641@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/167005767233.1899.2490889277144246641@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, kamiya33hirokazu@gmail.com
  Subject: Re: Explanation of the ROUND function with NUMERIC as an argument
  In-Reply-To: <167005767233.1899.2490889277144246641@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox