Re: Re: BUG #12885: The result of casting a double to an integer depends on the database version - Mailing list pgsql-bugs

From Andrew Gierth
Subject Re: Re: BUG #12885: The result of casting a double to an integer depends on the database version
Date
Msg-id 87384q2ejg.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: Re: BUG #12885: The result of casting a double to an integer depends on the database version  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-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)

pgsql-bugs by date:

Previous
From: Jeff Davis
Date:
Subject: Re: pg_get_constraintdef() doesn't always give an equal constraint
Next
From: Tom Lane
Date:
Subject: Re: pg_get_constraintdef() doesn't always give an equal constraint