Re: Rounding to even for numeric data type

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rounding to even for numeric data type
Date: 2015-03-28 20:34:32
Message-ID: 55171058.5010107@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28/03/15 21:58, Dean Rasheed wrote:
[...]
>
> Andrew mentioned that there have been complaints from people doing
> calculations with monetary data that we don't implement
> round-to-nearest-even (Banker's) rounding. It's actually the case that
> various different financial calculations demand different specific
> rounding modes, so it wouldn't be enough to simply change the default
> - we would have to provide a choice of modes.
[...]

Could the 2 current round functions have cousins that included an extra
char parameter (or string), that indicated the type of rounding?

So we don't end up with an explosion of rounding functions, yet could
cope with a limited set of additional rounding modes initially, and
possibly others in the future.

Cheers,
Gavin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2015-03-28 20:36:55 Re: Index-only scans with btree_gist
Previous Message Andres Freund 2015-03-28 18:36:22 Re: INSERT ... ON CONFLICT IGNORE (and UPDATE) 3.0