Skip to content

Cannot multiply Rational{Integer} and Float64 #58923

@AayushSabharwal

Description

@AayushSabharwal

MWE:

julia> Rational{Integer}(4//3) * 5.2
ERROR: promotion of types Rational{Integer} and Float64 failed to change any arguments
Stacktrace:
 [1] error(::String, ::String, ::String)
   @ Base ./error.jl:44
 [2] sametype_error(input::Tuple{Rational{Integer}, Float64})
   @ Base ./promotion.jl:424
 [3] not_sametype(x::Tuple{Rational{Integer}, Float64}, y::Tuple{Rational{Integer}, Float64})
   @ Base ./promotion.jl:418
 [4] promote
   @ ./promotion.jl:401 [inlined]
 [5] *(x::Rational{Integer}, y::Float64)
   @ Base ./promotion.jl:430
 [6] top-level scope
   @ REPL[34]:1

Which seems to indicate a missing promotion rule. I'd expect this to promote to Float64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    mathsMathematical functionsrationalsThe Rational type and values thereof

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions