I was searching how to convert a float to the simplest fraction that would convert back to it and found this answer.
Problem is, the Python implementation given relies on the as_integer_ratio
facility in the python standard library, which isn't present in Rust. I asked about this in a comment and found out about f64::frexp
but I'm not sure I understand how it works, as its documentation is quite cryptic (to me at least):
Breaks the number into a normalized fraction and a base-2 exponent, satisfying:
self = x * 2^exp
0.5 <= abs(x) < 1.0
And on top of that, it's an unstable feature.
What should I do?