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

From Tom Lane
Subject Re: dividing money by money
Date
Msg-id 27263.1279463237@sss.pgh.pa.us
Whole thread Raw
In response to Re: dividing money by money  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD
Next
From: Tom Lane
Date:
Subject: Re: Review: Patch for phypot - Pygmy Hippotause