robert-strandh / SICL

A fresh implementation of Common Lisp
Other
1.07k stars 78 forks source link

Some rational arithmetic #209

Closed Bike closed 3 years ago

Bike commented 3 years ago

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.