Count the number of digits after the decimal point. Use the number without the decimal point as the numerator. Use 1 followed by zeros the number of digits you counted as the denominator.
The will not work for number with an infinite number of decimal places.
There are method for repeating decimals, but they can get complicated.