Let the two numbers be $\dfrac{a}b$ and $\dfrac{c}d$. Find the difference, i.e., $$\dfrac{p}q = \dfrac{\vert ad-bc\vert}{bd}$$
Find $m=\lfloor \log(q/p) \rfloor$. This gives the digit where the difference occurs. Now take the largest of the fraction. Find the first $m$ digits, this gives you the answer.
Example:
For instance, consider the fractions, $a/b=37/87$ and $c/d=195/459$. It is easy to check which is lesser. Compare $459 \times 37$ and $87 \times 195$. In this case,
$195/459$ is lesser than $37/87$. Compute
$$\dfrac{p}q = \dfrac{a}b - \dfrac{c}d = \dfrac2{4437}$$
Now we get $m = \lfloor \log_{10}(4437/2) \rfloor = 3$. Now compute $a/b$ till the third digit. We get $a/b \approx 0.4252\ldots$. Stop at the third digit, which gives us $0.425$. We have
$$0.4248 \approx \dfrac{195}{459} < 0.425 \leq \dfrac{37}{87} \approx 0.4252$$