Implement rational() function for floats

The Ratio::rational() converts a float (f32 and f64) into a
Ratio<BigInt>.

Closes #9838