If your interval is $(a,b)$, then look at the square $U=(a,b)\times(a,b)$. If $\frac{b}{a}\geq z\geq 1$, then the subspace of $U$ such that $x/y>z$ is just a lower right triangle of $U$ going from $(az,a)$ to $(b,a)$ to $(b,\frac{b}z)$. This has area equal to $\frac{(b-az)(\frac{b}z - a)}2 = \frac{(b-az)^2}{2z}$. So if $g(z)=p(x/y>z) = \frac{(b-az)^2}{2z(b-a)^2}$, then the distribution should be $-g'(z)$ for $z>1$.
This gives a distribution of $\frac{\frac{b^2}{z^2}-a^2}{2(b-a)^2}$ for $z\geq 1$.
For $\frac{a}{b}<z\leq 1$, we do a similar computation to show that:
$$p(\frac{x}{y}<z) = \frac{(bz-a)^2}{2z(b-a)^2}$$
The derivative gives us the distribution for these $z$, so the value is here is:
$$\frac{b^2-\frac{a^2}{z^2}}{2(b-a)^2}$$
So the result is:
$$\frac{b^2-\frac{a^2}{z^2}}{2(b-a)^2}\text {when }\frac{a}b \leq z\leq 1$$
and
$$\frac{\frac{b^2}{z^2}-a^2}{2(b-a)^2}\text{ when }1\leq z \leq \frac{b}a$$