Fwd: Native type for storing fractions (e.g 1/3)?

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Fwd: Native type for storing fractions (e.g 1/3)?
Date: 2007-03-15 19:51:36
Message-ID: EDA06793-CB7C-497B-8972-BE468B6E94F3@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Florian G. Pflug 2007-03-15 19:58:15 Re: PITR and WAL archiving
Previous Message Ezequias R. da Rocha 2007-03-15 19:48:13 Problem to install pgAdmin