Skip to content

Commit e6f85c3

Browse files
committed
copy method now copies the variable
Originally, the copy method was implemented as copy(p::Poly) = Poly(copy(p.a)) But if the polynomial being copied doesn't use :x as a variable the new poly will not preserve the variable.
1 parent 6b65f47 commit e6f85c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Polynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function setindex!(p::Poly, v, i)
4141
v
4242
end
4343

44-
copy(p::Poly) = Poly(copy(p.a))
44+
copy(p::Poly) = Poly(copy(p.a), p.var)
4545

4646
zero{T}(p::Poly{T}) = zero(Poly{T})
4747
zero{T}(::Type{Poly{T}}) = Poly(T[])

0 commit comments

Comments
 (0)