Re: How useful is the money datatype? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: How useful is the money datatype?
Date
Msg-id b42b73150910030849v1cba612an6f35c2f728461235@mail.gmail.com
Whole thread Raw
In response to Re: How useful is the money datatype?  (Sam Mason <sam@samason.me.uk>)
Responses Re: How useful is the money datatype?
List 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 by date:

Previous
From: Sam Mason
Date:
Subject: Re: How useful is the money datatype?
Next
From: Greg Stark
Date:
Subject: Re: How useful is the money datatype?