Take the decimal number \$0.70710678\$. As a fraction, it'd be \$\frac{70710678}{100000000}\$, which simplifies to \$\frac{35355339}{50000000}\$. If you were to make the denominator \$1\$, the closest fraction is \$\frac{1}{1}\$. With \$2\$, it'd be \$\frac{1}{2}\$, and with \$3\$ it's \$\frac{2}{3}\$. Because \$0.\bar{6}\$ is closer to \$0.70710678\$ than \$\frac{3}{4}\$ or \$\frac{4}{5}\$, it would still be the closest with a maximum denominator up to (and including) \$6\$.
Task
There are two inputs: a decimal, and a maximum denominator.
The first input consists of a number \$n\$ as input, where \$0\le n<1\$, and the fractional part is represented with a decimal (although not necessarily using base 10). This can be represented as a floating point number, an integer representing a multiple of \$10^{-8}\$ (or some other sufficiently smaller number), a string representation of the number, or any other reasonable format.
The second input is an integer \$n\ge1\$, also taken in any reasonable format.
The output should be a fraction, with a denominator \$d\le n\$, where \$n\$ is the second input. This should be the closest fraction to the inputted decimal that is possible with the restrictions placed on the denominator. If there are multiple which are equally close (or equal to the inputted number), the one with the smallest denominator should be chosen. If there are two with the same denominator which are equidistant, either are acceptable.
The outputted fraction can be represented in any reasonable format, as long as it consists of a numerator and denominator, both being natural numbers.
Test cases
0.7 4 -> 2 / 3
0.25285 15 -> 1 / 4
0.1 10 -> 1 / 10
0.1 5 -> 0 / 1
0.68888889 60 -> 31 / 45
0.68888889 30 -> 20 / 29
0.0 2 -> 0 / 1
0.99999999 99 -> 1 / 1
Other
This is code-golf, shortest answer in bytes per language wins!