As you know, floating point numbers cannot store even simple numbers such as 0.1 exactly. If you use a naïve approach for converting floating point numbers, then you might end up with huge numerators and denomiators.
However, there are algorithms that might help: the Dragon4 and Grisu3 algorithms are designed to create the most readable output for floating point numbers. They take into advantage that certain floating point bit sequences can be expressed by several decimal fractions and choose the shortest of these.
For a first implementation, I would use Dragon4 and/or Grisu3 to create the shortest decimal fraction out of the floating point. For example the floating point number with the bits cd cc cc cc cc cc f4 3f
would result in the decimal fraction 1.3 instead of 1.29999999. I then would express the decimal fraction in the form a/b and simplify it. In the given example, this would be 13/10, with no further simplification.
Please note that the conversion into a decimal fraction may be a disadvantage. For example, the rational number 1/3 cannot be expressed exactly in both decimal and floating point numbers. So, the best solution would be to modify an algorithm such as Dragon4 to use arbitrary fractional denominators and not just 10. Alas, this almost certainly will require quite a lot of work and some CS background.