pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pedro Gimeno <pgsql-004@personal.formauri.es>
Cc: rschaaf@commoninf.com
Cc: pgsql-bugs\@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Re: BUG #12885: The result of casting a double to an integer depends on the database version
Date: Fri, 27 Mar 2015 23:55:50 +0000
Message-ID: <87384q2ejg.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CAEZATCXfrLyHmYq6S84W+zRrX2UW1e=+zGiZWXUF3hjYmndU8w@mail.gmail.com>
References: <20150320194337.2573.72944@wrigleys.postgresql.org>
	<26862.1427166720@sss.pgh.pa.us>
	<CAB7nPqST=EUbvsx-mapemgA0jD9e9sgVezaV-UvtkeMfXyrigw@mail.gmail.com>
	<13096.1427204266@sss.pgh.pa.us>
	<CAB7nPqSkh+Kma8+oGd5w67qZzSaVtkFo-2dgHwf5MAsr+enk4g@mail.gmail.com>
	<55121967.90308@personal.formauri.es>
	<CAB7nPqRRyhDtNMKC=vuTpO8XRwMEigyFh2VttnkC_eE7LbTAXQ@mail.gmail.com>
	<55129971.2070208@personal.formauri.es>
	<CAB7nPqQ=as+tSE6kA36RLpbueb__Zj_=L+wWonKMH5-nczj3yg@mail.gmail.com>
	<3736.1427294258@sss.pgh.pa.us>
	<5512E0AF.9050103@personal.formauri.es>
	<5512F2C0.9080007@personal.formauri.es>
	<8192.1427306273@sss.pgh.pa.us>
	<5512FE17.6020702@personal.formauri.es>
	<22366.1427313454@sss.pgh.pa.us>
	<87lhik4o45.fsf@news-spur.riddles.org.uk>
	<CAB7nPqQL4wsAX3E9gjQtOetgYQ8w7kWtFQQ3ctJfCc3PONjprA@mail.gmail.com>
	<87h9t84ig5.fsf@news-spur.riddles.org.uk>
	<CAB7nPqTtEJB08PEVj48SL4fFYMTaAxVX3CPE77SCpHYoZ3763Q@mail.gmail.com>
	<CAB7nPqRq94VT5WiYyCjSS+E_=mwWL49W-MXv5qgyR-8S91YY-w@mail.gmail.com>
	<CAEZATCXfrLyHmYq6S84W+zRrX2UW1e=+zGiZWXUF3hjYmndU8w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

>>>>> "Dean" == Dean Rasheed <dean.a.rasheed@gmail.com> writes:

 Dean> I'm not convinced that it is a good idea to change the default
 Dean> rounding mode for numeric.

 Dean> For one thing, numeric is commonly used for monetary data, and
 Dean> changing the default rounding mode might well break existing
 Dean> applications where rounding is important, and which rely on the
 Dean> current behaviour.

On the other hand, we've had complaints (on IRC) from people doing
calculations with monetary data who complain that we don't do
round-to-even (which is widely known as "Banker's Rounding") as their
requirements demand.

To quote the last person who brought it up there:

 >> We have strict accounting practice to follow -- and our CFO has
 >> instructed to use even-rounding (aka bankers rounding)... and to not
 >> use our typical rounding behavior we learned in 1st grade. :)

 Dean> Adding a version of round() with support for a choice of various
 Dean> rounding modes might be a better way to go.

There's still the issue of casting to ::numeric(m,n) to consider, and
whatever internal rounding is being done in division and numeric
functions.

 Dean> Also, if the default is being changed, I think that merits wider
 Dean> discussion (on a thread with a more appropriate title) to see if
 Dean> it is likely to be an issue for anyone.

Absolutely.

-- 
Andrew (irc:RhodiumToad)


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (31+ messages)

Message-ID: <87384q2ejg.fsf@news-spur.riddles.org.uk>
Permalink:  ../87384q2ejg.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87384q2ejg.fsf@news-spur.riddles.org.uk

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, dean.a.rasheed@gmail.com, michael.paquier@gmail.com, tgl@sss.pgh.pa.us, pgsql-004@personal.formauri.es, rschaaf@commoninf.com
  Subject: Re: BUG #12885: The result of casting a double to an integer depends on the database version
  In-Reply-To: <87384q2ejg.fsf@news-spur.riddles.org.uk>
  References: <20150320194337.2573.72944@wrigleys.postgresql.org> <CAB7nPqSkh+Kma8+oGd5w67qZzSaVtkFo-2dgHwf5MAsr+enk4g@mail.gmail.com> <55121967.90308@personal.formauri.es> <CAB7nPqRRyhDtNMKC=vuTpO8XRwMEigyFh2VttnkC_eE7LbTAXQ@mail.gmail.com> <55129971.2070208@personal.formauri.es> <CAB7nPqQ=as+tSE6kA36RLpbueb__Zj_=L+wWonKMH5-nczj3yg@mail.gmail.com> <3736.1427294258@sss.pgh.pa.us> <5512E0AF.9050103@personal.formauri.es> <5512F2C0.9080007@personal.formauri.es> <8192.1427306273@sss.pgh.pa.us> <5512FE17.6020702@personal.formauri.es> <22366.1427313454@sss.pgh.pa.us> <87lhik4o45.fsf@news-spur.riddles.org.uk> <CAB7nPqQL4wsAX3E9gjQtOetgYQ8w7kWtFQQ3ctJfCc3PONjprA@mail.gmail.com> <87h9t84ig5.fsf@news-spur.riddles.org.uk> <CAB7nPqTtEJB08PEVj48SL4fFYMTaAxVX3CPE77SCpHYoZ3763Q@mail.gmail.com> <CAB7nPqRq94VT5WiYyCjSS+E_=mwWL49W-MXv5qgyR-8S91YY-w@mail.gmail.com> <CAEZATCXfrLyHmYq6S84W+zRrX2UW1e=+zGiZWXUF3hjYmndU8w@mail.gmail.com> <87384q2ejg.fsf@news-spur.riddles.org.uk>

* 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