]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-140443: Use `fma` in `loghelper` to improve accuracy of log for very large integer...
authorAbhishek Tiwari <Abhi210@users.noreply.github.com>
Thu, 23 Oct 2025 17:05:12 +0000 (22:35 +0530)
committerGitHub <noreply@github.com>
Thu, 23 Oct 2025 17:05:12 +0000 (12:05 -0500)
commitf0291c3f2df8139870359c7d1d9a4858f19ee7bf
tree3d3794b69d1e777da5604b010c1f8dbb85ee12ab
parent918a9ac9f403c0a79003d0f97c527e444c99456d
gh-140443: Use `fma` in `loghelper` to improve accuracy of log for very large integers (#140469)

* gh-140443:use fma in loghelper to improve accuracy of log for very large integers

Use fused multiply-add in log_helper() for huge ints.

Saving a rounding here is remarkably effective. Across some millions
of randomized test cases with ints up to a billion bits, on Windows
and using log10, the ULP error distribution was dramatically
flattened, and its range was nearly cut in half. In fact, the largest
error Tim saw was under 0.6 ULP.

---------

Co-authored-by: abhi210 <27881020+Abhi210@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Misc/ACKS
Misc/NEWS.d/next/Core_and_Builtins/2025-10-22-23-26-37.gh-issue-140443.wT5i1A.rst [new file with mode: 0644]
Modules/mathmodule.c