Case I: Finite Decimal
Suppose that the decimal is $$.a_1a_2\ldots a_n$$ Then by definition of that notation, the number can be written $$\frac{a_1}{10}+\frac{a_2}{10^2}+\cdots+\frac{a_n}{10^n}$$ You can then combine the fractions and reduce.
Example. $$.18=\frac{18}{100}=\frac{9}{50}$$
Case II: Infinite Repeating Decimal
We already know that the first (finite) non-repeating component may be written as a decimal per the algorithm above. For the repeating part $$.00\ldots 0a_1a_2\ldots a_na_1\ldots a_n\cdots$$ which the sequence $a_1\ldots a_n$ repeated infinitely, we have by the formula $$a+ar+ar^2+\cdots=\frac{a}{1-r}\qquad (|r|<1)$$ that, if there are $m$ zeros initially, $$\begin{align}.0\ldots 0\overline{a_1\ldots a_n}&=\frac{a_1\ldots a_n}{10^{m+n}}+\frac{a_1\ldots a_n}{10^{m+2n}}+\cdots \\ &=\frac{a_1\ldots a_n}{10^{m+n}}\left(1+10^{-n}+10^{-2n}+\cdots\right) \\ &=\frac{a_1\ldots a_n}{10^{m+n}}\left(\frac{1}{1-10^{-n}}\right)\end{align}$$
Example. $$0.333\ldots=\frac{3}{10}\left(1+\frac{1}{10}+\frac{1}{10^2}+\cdots\right)=\frac{3}{10}\left(\frac{1}{1-10^{-1}}\right)=\frac{3}{10-1}=\frac{1}{3}$$
Case III: Infinite Non-Repeating Decimal
These types of numbers are called irrational, and cannot be written as fractions of integers (for example, $\sqrt 2$ has no fractional expression).
However, they can be approximated by fractions to any degree of accuracy needed. A straightforward algorithm for doing this is provided by the theory of the Stern-Brocot tree. It provides the "simplest" approximation which starts with the correct $n$ decimal places.
Example. The decimal expansion of $\pi$ (an irrational number) begins $3.141592653589793\ldots$. Using a computer program, I find that the first few best rational approximations for the decimal part $.141592653589793\ldots$ are $$\begin{align}{1 \over 7} &=0.142... \\ {9 \over 64} &=0.1406... \\ {15\over 106} &=0.14150... \\ {16\over 113}&=0.1415929... \\ &\;\vdots \\ {3612111\over 25510582}&=0.14159265358979267...\end{align}$$
When you work in inches, the only common fractions are powers of $2$. The challenge is where to stop. We know $\frac 12=0.50000$ and $\frac {15}{32}=0.46875$ How close do you need to be to $0.50000$ to decide that the true answer is not some larger denominator? This is not a mathematical question. Certainly if I saw $0.499999995$ I would think it was more likely $\frac 12$ than some fraction with a very large denominator. If I saw $0.48$ I wouldn't be sure whether I should round it to $\frac 12$ or $\frac {15}{32}$. It is closer to $\frac {15}{32},$ but $\frac 12$ is so much more common. If your data comes from people with rulers, I would be confident that no measurement is reported to better than $\frac 1{32}$ inch, so I would round to the closest one of those. Your data are all good to within $\pm 0.01$ inch, which will allow you to find the closest thirty-second. Count your blessings.
Best Answer
To complete Ashvin Swaminathan's answer:
$$x = \frac{n-1 \pm \sqrt{n^2 + 2n + 5}}{2}$$
Because $x > 0$, we take $$x = \frac{n-1 + \sqrt{n^2 + 2n + 5}}{2}$$
Since the discriminant $n^2 + 2n + 5 = (n+1)^2 + 4 \geq 4$, then there are indeed infinitely many solutions, and these depend on $n = \lfloor{x}\rfloor$.