mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
The pow() variant further improves accuracy (GH-102866)
This commit is contained in:
parent
4075fe1d8d
commit
1a5a14183e
1 changed files with 1 additions and 1 deletions
|
@ -876,7 +876,7 @@ which incur interpreter overhead.
|
|||
n = len(coefficients)
|
||||
if n == 0:
|
||||
return x * 0 # coerce zero to the type of x
|
||||
powers = accumulate(repeat(x, n - 1), operator.mul, initial=1)
|
||||
powers = map(pow, repeat(x), range(n))
|
||||
return math.sumprod(reversed(coefficients), powers)
|
||||
|
||||
def polynomial_from_roots(roots):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue