Re: How useful is the money datatype?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How useful is the money datatype?
Date: 2009-10-03 15:49:50
Message-ID: b42b73150910030849v1cba612an6f35c2f728461235@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Oct 3, 2009 at 11:40 AM, Sam Mason <sam(at)samason(dot)me(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2009-10-03 16:05:39 Re: How useful is the money datatype?
Previous Message Sam Mason 2009-10-03 15:40:23 Re: How useful is the money datatype?