Re: [HACKERS] Question about the TODO, numerics, and division

2007-03-21 Thread Bruce Momjian
Here is the full TODO item: * Add NUMERIC division operator that doesn't round? Currently NUMERIC _rounds_ the result to the specified precision. This means division can return a result that multiplied by the divisor is greater than the dividend, e.g

Re: [HACKERS] Question about the TODO, numerics, and division

2007-03-21 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > but I wouldn't want to defend the details of the rule about how many > fractional digits out given so many fractional digits in. In particular it seems to me this is poor: postgres=# select 1::numeric/10; ?column?

Re: [HACKERS] Question about the TODO, numerics, and division

2007-03-21 Thread Martijn van Oosterhout
On Tue, Mar 20, 2007 at 08:27:46PM -0400, Tom Lane wrote: > and of course if you multiply that by 6 you get > > regression=# SELECT (10::numeric(2,0) / 6::numeric(2,0)) * 6; > ?column? > - > 10.0002 > (1 row) The only way to fix that is to shift from fixed-p

Re: [HACKERS] Question about the TODO, numerics, and division

2007-03-20 Thread Tom Lane
Chris Travers <[EMAIL PROTECTED]> writes: > I have been looking at the TODO and have found something that I find > sort of odd and we should probably reconsider: > One of the items under data types is: > * Add NUMERIC division operator that doesn't round? > Currently NUMERIC _rounds_