Re: dividing money by money

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Andy Balholm <andy(at)balholm(dot)com>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: dividing money by money
Date: 2010-07-18 09:04:11
Message-ID: 1279443851.30539.12.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

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".

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-07-18 14:15:55 Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD
Previous Message Peter Eisentraut 2010-07-18 09:00:33 Re: dividing money by money

Browse pgsql-www by date

  From Date Subject
Next Message Tom Lane 2010-07-18 14:27:17 Re: dividing money by money
Previous Message Peter Eisentraut 2010-07-18 09:00:33 Re: dividing money by money