Re: Native type for storing fractions (e.g 1/3)? - Mailing list pgsql-general

From Ken Johanson
Subject Re: Native type for storing fractions (e.g 1/3)?
Date
Msg-id 45F9A0E1.400@kensystem.com
Whole thread Raw
In response to Re: Native type for storing fractions (e.g 1/3)?  ("John D. Burger" <john@mitre.org>)
List 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



pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: Lifecycle of PostgreSQL releases
Next
From: "John D. Burger"
Date:
Subject: Fwd: Native type for storing fractions (e.g 1/3)?