Almost certainly, but that detail is buried in the GMP function mpq_set_d
which sets a rational fraction from a floating point value. It’s called from both the rational
arithmetic function and the new C implementation of rationalize
.
There may be faster ways of creating the starting “rational” (not necessarily canonicalized) but I can’t think of any easier, so I’m inclined to leave it until some new use case requires an incremental improvement. (There’s now a PR for the new implementation so the whole source is available for review.)