Re: Native type for storing fractions (e.g 1/3)?
От | Ken Johanson |
---|---|
Тема | Re: Native type for storing fractions (e.g 1/3)? |
Дата | |
Msg-id | 45F9A0E1.400@kensystem.com обсуждение исходный текст |
Ответ на | Re: Native type for storing fractions (e.g 1/3)? ("John D. Burger" <john@mitre.org>) |
Список | 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 по дате отправления: