From: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How useful is the money datatype? |
Date: | 2009-10-03 16:19:49 |
Message-ID: | 20091003161949.GD5407@samason.me.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Oct 03, 2009 at 11:49:50AM -0400, Merlin Moncure wrote:
> On Sat, Oct 3, 2009 at 11:40 AM, Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:
> > 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).
>
> I don't quite agree with your statement (I agree with your point, just
> not the way you worded it).
Maybe I didn't emphasize "numeric" enough; the current implementation
of numeric datatypes in PG does not allow fractions to be represented
accurately. Is that any better?
> I could make a type, 'rational', define
> the numerator, denominator, and do calculations like the above with
> zero loss.
Yes, if you defined a datatype like this then it would be able to
express a strictly larger subset of all numbers.
> So it depends how you define 'represent'.
> Computers can do pretty much any type of bounded calculation given
> enough time and memory.
Which is why I said "with infinite precision". Assuming infinite time
or space doesn't seem to help with any real world problem, it's the
details of the assumptions made and the use case(s) optimized for that
tend to be interesting.
--
Sam http://samason.me.uk/
From | Date | Subject | |
---|---|---|---|
Next Message | Corey Tisdale | 2009-10-03 16:25:14 | Embarassing GROUP question |
Previous Message | Greg Stark | 2009-10-03 16:19:09 | Re: PostgreSQL reads each 8k block - no larger blocks are used - even on sequential scans |