I think the reason is that
-
calculations with eg Rational{Int64}
would quickly overflow for the denominator,
-
the results of transcendental functions (exp
) cannot be a rational number in general.
So it is safest to promote to Float64
. Of course, the trade-off is floating point inaccuracy.
Generally, I would just not promote but leave it to the operation. For a more specific workaround, please provide more context.
1 Like