Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.13] pythongh-113841: fix possible undefined division by 0 in _Py_c…
…_pow() (pythonGH-127211) (pythonGH-127216) Note, that transformed expression is not an equivalent for original one (1/exp(-x) != exp(x) in general for floating-point numbers). Though, the difference seems to be ~1ULP for good libm implementations. It's more interesting why division was used from beginning. Closest algorithm I've found (no error checks, of course;)) - it's Algorithm 190 from ACM: https://dl.acm.org/doi/10.1145/366663.366679. It uses subtraction in the exponent. (cherry picked from commit f7bb658) (cherry picked from commit f41d8d8) Co-authored-by: Miss Islington (bot) <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
- Loading branch information