]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix bug in poly.minus
authorGuido van Rossum <guido@python.org>
Thu, 20 Oct 1994 22:02:03 +0000 (22:02 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 20 Oct 1994 22:02:03 +0000 (22:02 +0000)
Lib/poly.py

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