Re: dividing money by money

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: dividing money by money
Дата
Msg-id 27263.1279463237@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: dividing money by money  (Peter Eisentraut <peter_e@gmx.net>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Review: Patch for phypot - Pygmy Hippotause