I&#x27;ll wrap up a new version of the library that&#x27;s independent of what I have it hooked up to and upload it to npm and hex.pm respectively.<p>When I first wrote it, I started with midpoints but it doesn&#x27;t take long to see that it gets messy to optimize. I eventually stumbled on the b-tree representation of all positive rational numbers (Stern-Brocot) and the optimization became obvious.