Extends addition, multiplication, and comparison to ratios
Defines division for rationals
Defines gcd, lcm c.f. #208
Defines signum for rationals
Rewrites expt as a loop and extends it to negative integer powers and rational bases
I put in a few optimizations but nothing too detailed. For example integer-ratio operations are generally written to divide out common factors rather than cons up large intermediate products. It's very not-optimal for large bignums though, and more comprehensive optimization might involve some uglier rewrites to keep type information.
I did some quick tests on each definition individually but didn't really try to incorporate them into the build process or anything.
gcd
,lcm
c.f. #208signum
for rationalsexpt
as a loop and extends it to negative integer powers and rational basesI put in a few optimizations but nothing too detailed. For example integer-ratio operations are generally written to divide out common factors rather than cons up large intermediate products. It's very not-optimal for large bignums though, and more comprehensive optimization might involve some uglier rewrites to keep type information.
I did some quick tests on each definition individually but didn't really try to incorporate them into the build process or anything.