Part of #5122 "Faster conversion between Rational and Double/Float" fix