Uh oh!
There was an error while loading. Please reload this page.
gh-121149: improve accuracy of builtin sum() for complex inputs - #121176
Conversation
picnixz
left a comment
There was a problem hiding this comment.
Not much to say on that PR except some style comments.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
skirpichev
commented
Jul 2, 2024
That's out of the scope for this pr. |
Uh oh!
There was an error while loading. Please reload this page.
rhettinger
commented
Jul 2, 2024
Overall this patch looks basically sound. If you're open to change, I wish it was in more of a functional style than a mutate in place style. I find the latter harder to read and harder to debug. Also the name I suggest something like this: It could be used very plainly and readably, making it obvious what is changing: I'm not attached to the names only the core concept. Use |
skirpichev
commented
Jul 3, 2024
Thanks, I like new names.
That was chosen for compatibility with the referenced wiki page, but the later variant does make sense too. And it's already used in the fsum(). 2698be6 - renaming part
Does make sense. I did this change in the second commit, 5242bd6 (with a minor change: don't introduce temporary As we inline all helpers - this variant should have same performance as in the commit above. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* Use compensated summation for complex sums with floating-point items. This amends python#121176. * sum() specializations for floats and complexes now use PyLong_AsDouble() instead of PyLong_AsLongAndOverflow() and compensated summation as well.
📚 Documentation preview 📚: https://cpython-previews--121176.org.readthedocs.build/