Re: How useful is the money datatype?

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: How useful is the money datatype?
Дата
Msg-id b42b73150910030849v1cba612an6f35c2f728461235@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How useful is the money datatype?  (Sam Mason <sam@samason.me.uk>)
Ответы Re: How useful is the money datatype?
Список pgsql-general
On Sat, Oct 3, 2009 at 11:40 AM, Sam Mason <sam@samason.me.uk> wrote:
> On Sat, Oct 03, 2009 at 12:20:57PM +0100, Raymond O'Donnell wrote:
>> I thought the idea of NUMERIC was that the value was exact, avoiding
>> rounding problems that you might get with other floating-point types?
>
> Nope, sorry it's still a computer and thus can't represent anything
> with infinite precision (just numeric fractions in PG's case, let alone
> irrational numbers). For example:
>
>  select (numeric '1'/3) * 3;
>

I don't quite agree with your statement (I agree with your point, just
not the way you worded it).  I could make a type, 'rational', define
the numerator, denominator, and do calculations like the above with
zero loss.  So it depends how you define 'represent'.

Computers can do pretty much any type of bounded calculation given
enough time and memory.

merlin

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

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: How useful is the money datatype?
Следующее
От: Greg Stark
Дата:
Сообщение: Re: How useful is the money datatype?