Skip to content

Commit 710e88d

Browse files
committed
Fix #128
1 parent 8b59004 commit 710e88d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Base.isless(t1::AbstractTerm, t2::AbstractTerm)
77
if monomial(t1) < monomial(t2)
88
true
99
elseif monomial(t1) == monomial(t2)
10-
coefficient(t1) < coefficient(t2)
10+
abs(coefficient(t1)) < abs(coefficient(t2))
1111
else
1212
false
1313
end

test/polynomial.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,11 @@ const MP = MultivariatePolynomials
166166
@test T[y, z] == @inferred effective_variables(z + 0 * x + y)
167167
@test T[z] == @inferred effective_variables(z + 0 * x + y^0)
168168
end
169+
170+
@testset "Complex" begin
171+
# See https://github.com/JuliaAlgebra/MultivariatePolynomials.jl/issues/128
172+
Mod.@polyvar x
173+
p = im * x + 2im * x^2
174+
@test p * p == -x^2 - 4x^4 - 4x^3
175+
end
169176
end

0 commit comments

Comments
 (0)