File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -252,14 +252,12 @@ dot(p1::Poly, p2::Poly) = p1 * p2
252252+ {T<: Number }(c:: T , p:: Poly ) = + (p, c)
253253function + {S,T<: Number }(p:: Poly{S} , c:: T )
254254 U = promote_type (S,T)
255- degree (p) == 0 && return Poly (U[c], p. var)
256255 p2 = U == S ? copy (p) : convert (Poly{U}, p)
257256 p2[0 ] += c
258257 return p2
259258end
260259function - {T<: Number ,S}(c:: T , p:: Poly{S} )
261260 U = promote_type (S,T)
262- degree (p) == 0 && return Poly (U[c], p. var)
263261 p2 = convert (Poly{U}, - p)
264262 p2[0 ] += c
265263 return p2
Original file line number Diff line number Diff line change @@ -289,3 +289,5 @@ p = Poly([0,one(Float64)])
289289@test Poly{Complex{Float64}} == typeof (p+ 1im )
290290@test Poly{Complex{Float64}} == typeof (1im - p)
291291@test Poly{Complex{Float64}} == typeof (p* 1im )
292+ @test Poly ([0.5 ]) + 2 == Poly ([2.5 ])
293+ @test 2 - Poly ([0.5 ]) == Poly ([1.5 ])
You can’t perform that action at this time.
0 commit comments