From 45bd09af9d2d6aed4dab0f03755d64d1ba8802b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 29 Oct 2024 21:01:27 +0100 Subject: [PATCH] Fix UnivPoly adhoc subtraction (#1881) Co-authored-by: Max Horn --- src/generic/UnivPoly.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/generic/UnivPoly.jl b/src/generic/UnivPoly.jl index 40f995f4fe..54d264436a 100644 --- a/src/generic/UnivPoly.jl +++ b/src/generic/UnivPoly.jl @@ -516,9 +516,15 @@ for op in (:+, :-, :*) return UnivPoly{T}($op(data(p),n), S) end - $op(n::Union{Integer, Rational, AbstractFloat}, p::UnivPoly) = $op(p,n) + function $op(n::Union{Integer, Rational, AbstractFloat}, p::UnivPoly{T}) where {T} + S = parent(p) + return UnivPoly{T}($op(n,data(p)), S) + end - $op(n::T, p::UnivPoly{T}) where {T <: RingElem} = $op(p,n) + function $op(n::T, p::UnivPoly{T}) where {T <: RingElem} + S = parent(p) + return UnivPoly{T}($op(n,data(p)), S) + end end end