pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rudolph Froger <rudolphfroger@dreamsolution.nl>
To: pgsql-docs@lists.postgresql.org
Subject: Rounding strategy of round function
Date: Fri, 26 Mar 2021 15:46:08 +0100
Message-ID: <ce181e29-2bb2-5f98-b405-351bea1885af@dreamsolution.nl> (raw)

The 'round' mathematical function doesn't document which rounding 
strategy it uses. If this would be documented then users can rely on its 
rounding behavior. For double precision the rounding probably depends on 
your platform. For numeric is the function seems to round to nearest 
with ties (a 5) going away from zero (sometimes referred to as "round 
half up). 6.5 -> 7.0 and -6.5 -> -7.0.

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

Kind regards, Rudolph

Attachments:

  smime.p7s (application/pkcs7-signature, 4.5K) download

Message-ID: <ce181e29-2bb2-5f98-b405-351bea1885af@dreamsolution.nl>
Permalink:  ../ce181e29-2bb2-5f98-b405-351bea1885af@dreamsolution.nl/
Also on:    postgresql.org/message-id/ce181e29-2bb2-5f98-b405-351bea1885af@dreamsolution.nl

 · 

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: rudolphfroger@dreamsolution.nl, pgsql-docs@lists.postgresql.org
  Subject: Re: Rounding strategy of round function
  In-Reply-To: <ce181e29-2bb2-5f98-b405-351bea1885af@dreamsolution.nl>

* 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