8000 The pow() variant further improves accuracy (GH-102866) · python/cpython@1a5a141 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a5a141

Browse files
authored
The pow() variant further improves accuracy (GH-102866)
1 parent 4075fe1 commit 1a5a141

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Doc/library/itertools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ which incur interpreter overhead.
876876
n = len(coefficients)
877877
if n == 0:
878878
return x * 0 # coerce zero to the type of x
879-
powers = accumulate(repeat(x, n - 1), operator.mul, initial=1)
879+
powers = map(pow, repeat(x), range(n))
880880
return math.sumprod(reversed(coefficients), powers)
881881

882882
def polynomial_from_roots(roots):

0 commit comments

Comments
 (0)
0