Re: dividing money by money
Peter Eisentraut <peter_e@gmx.net>
From: Peter Eisentraut <peter_e@gmx.net>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Andy Balholm <andy@balholm.com>, pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-07-18T09:04:11Z
Lists: 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".