Let $M$, $N$ be large natural numbers (say ~200 bits). Let $L$ be a smaller number, (say ~100 bits). I want to approximate the fraction: $$\frac{M}{N} \sim \frac{k}{L+r}$$ where $r$ is at most $L$. In other words, I want to find good approximations to $M/N$ with denominator larger than $L$ but less than $(1+\delta)L$ where $\delta < 1$ (say $0.5$ for example). The standard Stern-Brocot binary search tree can give me good approximations, but it gives no guarantee that these approximations have denominator between $L$ and $(1+\delta)L$. https://www.johndcook.com/blog/2010/10/20/best-rational-approximation/ https://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree https://en.wikipedia.org/wiki/Continued_fraction#Best_rational_approximations Any modifications we can make to the search to give us the desired approximations?