From: | Ken Johanson <pg-user(at)kensystem(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | "John D(dot) Burger" <john(at)mitre(dot)org> |
Subject: | Re: Native type for storing fractions (e.g 1/3)? |
Date: | 2007-03-15 19:39:13 |
Message-ID: | 45F9A0E1.400@kensystem.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
John D. Burger wrote:
> Stephane Bortzmeyer wrote:
>
>> But he can write one in PostgreSQL quite easily. Rational numbers are
>> always the first exercice in CS courses about Abstract Data Types :-)
>
> It's a little tricky to get good performance for all the operations:
>
>> The addition and subtraction operations are complex. They will require
>> approximately two gcd operations, 3 divisions, 3 multiplications and
>>
[..trimed]
>
> (From the Booost rational package -
> http://www.boost.org/libs/rational/rational.html)
>
> I'd try to link to an existing library that provides rationals, or model
> my code closely after one.
>
Yes, it may be easy to create composite type but the operands would
still be needed.
Select n FROM t WHERE frac1 < frac2;
John, do you how compatible the Booost license is (or can be made :-)
with PG, in the case where adding this to the server as a standard
datum-type might be very useful (for me anyway).
Ken
PS - Sorry for the re-send with-the-list, John
From | Date | Subject | |
---|---|---|---|
Next Message | Ezequias R. da Rocha | 2007-03-15 19:48:13 | Problem to install pgAdmin |
Previous Message | Erik Jones | 2007-03-15 19:00:17 | Re: Lifecycle of PostgreSQL releases |