Why do Rationals promote to Floats

To be precise, a Rational and Float64 promote to Float64. (A Rational and an Int promote to a Rational, for example.) The basic principle is that floating-point values are typically inexact approximations for some other real number, so if you are combining them with a rational value you usually expect an inexact result anyway. In that case, converting the rational to the closest floating-point value is not typically a problem.

Keeping things as Rational values during computations, on the other hand, is unusual for the reasons @Tamas_Papp mentioned.

If you want exact rational constants like 1.25 in your code that are automatically converted to the best precision when combined with other values, it is better to represent them as Rational values like 5//4.

7 Likes