Re: dividing money by money

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

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> 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".

[ shrug... ] A lot of people think that about the money type, all for
different reasons. This particular argument seems tissue-thin to me,
mainly because the same people who complain "it must be exact" have no
problem rounding off their results to the nearest pfennig or whatever.
Also, you seem not to have absorbed the fact that changing the output
to numeric *will not make the result exact anyway*. If the point of
a business rule of this sort is to prohibit inexact calculations, then
having it flag cash / cash as inexact is a Good Thing.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-07-18 14:50:32 Re: Review: Patch for phypot - Pygmy Hippotause
Previous Message Tom Lane 2010-07-18 14:15:55 Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD

Browse pgsql-www by date

  From Date Subject
Next Message Joshua D. Drake 2010-07-20 00:16:37 Re: Poor Yum User Download Experience
Previous Message Peter Eisentraut 2010-07-18 09:04:11 Re: dividing money by money