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



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to