Re: dividing money by money

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: dividing money by money
Дата
Msg-id 1279443851.30539.12.camel@vanquo.pezone.net
обсуждение исходный текст
Ответ на Re: dividing money by money  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: dividing money by money  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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".




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: dividing money by money
Следующее
От: Tom Lane
Дата:
Сообщение: Re: crash-recovery replay of CREATE TABLESPACE is broken in HEAD