SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

0 0 0 Python

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>
A
Abhishek Tiwari committed
f0291c3f2df8139870359c7d1d9a4858f19ee7bf
Parent: 918a9ac
Committed by GitHub <noreply@github.com> on 10/23/2025, 5:05:12 PM