[issue41458] Avoid overflow/underflow in math.prod()

Raymond Hettinger report at bugs.python.org
Thu Aug 6 15:45:13 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

FWIW, the occasions where this mattered all involved a mix of multiplications and divisions that mostly cancel out.   

The quadratic formula example is typical:   product([4.0, a, c, 1.0/b, 1.0/b].

Or a floating point implementation of comb(): product([1000, 999, 998, 997, 1/4, 1/3, 1/2, 1/1])

Or terms in series expansions where both the numerator and denominator have many factors.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41458>
_______________________________________


More information about the Python-bugs-list mailing list