fix bug in poly.minus

This commit is contained in:
Guido van Rossum 1994-10-20 22:02:03 +00:00
parent 05bf280d47
commit 971dc53f0e
1 changed files with 2 additions and 5 deletions

View File

@ -20,11 +20,8 @@ def plus(a, b):
return normalize(res) return normalize(res)
def minus(a, b): def minus(a, b):
if len(a) < len(b): a, b = b, a # make sure a is the longest neg_b = map(lambda x: -x, b[:])
res = a[:] # make a copy return plus(a, neg_b)
for i in range(len(b)):
res[i] = res[i] - b[i]
return normalize(res)
def one(power, coeff): # Representation of coeff * x**power def one(power, coeff): # Representation of coeff * x**power
res = [] res = []