@@ -32,7 +32,8 @@ Base.rem(f::APL, g::Union{APL, AbstractVector{<:APL}}; kwargs...) = divrem(f, g;
3232
3333proddiff (x, y) = x/ y - x/ y
3434function Base. divrem (f:: APL{T} , g:: APL{S} ; kwargs... ) where {T, S}
35- rf = convert (polynomialtype (f, Base. promote_op (proddiff, T, S)), MA. copy_if_mutable (f))
35+ # `promote_type(typeof(f), typeof(g))` is needed for TypedPolynomials in case they use different variables
36+ rf = convert (polynomialtype (promote_type (typeof (f), typeof (g)), Base. promote_op (proddiff, T, S)), MA. copy_if_mutable (f))
3637 q = zero (rf)
3738 r = zero (rf)
3839 lt = leadingterm (g)
@@ -60,7 +61,8 @@ function Base.divrem(f::APL{T}, g::APL{S}; kwargs...) where {T, S}
6061 q, r
6162end
6263function Base. divrem (f:: APL{T} , g:: AbstractVector{<:APL{S}} ; kwargs... ) where {T, S}
63- rf = convert (polynomialtype (f, Base. promote_op (proddiff, T, S)), MA. copy_if_mutable (f))
64+ # `promote_type(typeof(f), eltype(g))` is needed for TypedPolynomials in case they use different variables
65+ rf = convert (polynomialtype (promote_type (typeof (f), eltype (g)), Base. promote_op (proddiff, T, S)), MA. copy_if_mutable (f))
6466 r = zero (rf)
6567 q = similar (g, typeof (rf))
6668 for i in eachindex (q)
0 commit comments