Skip to content

Commit a71ad37

Browse files
committed
Fix #71
1 parent 623846b commit a71ad37

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/ncmult.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function multiplyvar(v::Vector{PolyVar{false}}, z::Vector{Int}, x::PolyVar{false
3030
end
3131
i += 1
3232
while i <= length(v) && v[i] != x
33-
if v[i] > v[i-1]
33+
if i > 1 && v[i] > v[i - 1]
3434
ndrop += 1
3535
end
3636
if ndrop >= droplim2 || (ndrop >= droplim1 && v[i] < x)
@@ -70,7 +70,7 @@ function multiplyvar(x::PolyVar{false}, v::Vector{PolyVar{false}}, z::Vector{Int
7070
end
7171
i -= 1
7272
while i > 0 && v[i] != x
73-
if v[i] < v[i+1]
73+
if i > 1 && v[i] < v[i + 1]
7474
ndrop += 1
7575
end
7676
if ndrop >= droplim2 || (ndrop >= droplim1 && v[i] > x)

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ using LinearAlgebra
1212
@test polynomial(Q, monovec(x)) == p
1313
end
1414

15+
@testset "Issue #71" begin
16+
@test x^0 * y == y * x^0
17+
end
18+
1519
include("mono.jl")
1620
include("poly.jl")
1721
include("comp.jl")

0 commit comments

Comments
 (0)