Implement Ratio:from_float()

The Ratio::from_float() converts a float (f32 and f64) into a
Ratio<BigInt>.

Closes #9838
auto merge of #11125 : vmx/rust/rational, r=huonw

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