Re: dividing money by money - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: dividing money by money
Date
Msg-id 1279443851.30539.12.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: dividing money by money  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: dividing money by money
List pgsql-hackers
On lör, 2010-07-17 at 10:00 -0500, Kevin Grittner wrote:
> True.  If we added money * numeric, then it would make more sense to
> have money / money return numeric.  On the other hand, I couldn't
> come up with enough use cases for that to feel that it justified the
> performance hit on money / money for typical use cases -- you
> normally want a ratio for things where float8 is more than
> sufficient; and you can always cast the arguments to numeric for
> calculations where the approximate result isn't good enough. 
> Basically, once we agreed to include casts to and from numeric, it
> seemed to me we had it covered.

I have never used the money type, so I'm not in a position to argue what
might be typical use cases, but it is well understood that using
floating-point arithmetic anywhere in calculations involving money is
prohibited by law or business rules in most places.  So when I read that
multiplications or divisions involving the money type use float, to me
that means the same as "never use the money type, it's broken".




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: dividing money by money
Next
From: Tom Lane
Date:
Subject: Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD