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