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

From John D. Burger
Subject Fwd: Native type for storing fractions (e.g 1/3)?
Date
Msg-id EDA06793-CB7C-497B-8972-BE468B6E94F3@mitre.org
Whole thread Raw
List pgsql-general
Oops, I though Ken had written privately to me - here's my reply:

>> (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).

I was just using the Boost rational package as an example, mostly to
quote those implementation comments from the docs.  Boost is a set of
C++ libraries, PG is C, so no direct adoption possible.

However, I think the Boost license is essentially BSD-like, so it
might be possible to steal the algorithms pretty easily.  I haven't
looked, but I would be surprised if there was much OOP in the
rational code, it might be fairly trivial to "dumb it down" to C.

- John D. Burger
   MITRE




pgsql-general by date:

Previous
From: Ken Johanson
Date:
Subject: Re: Native type for storing fractions (e.g 1/3)?
Next
From: "Ezequias R. da Rocha"
Date:
Subject: Problem to install pgAdmin