-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
DOC: Mention and try to explain pairwise summation in sum #13737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note that this behavour is of course inherited into `np.add.reduce` and many other reductions such as `mean` or users of this reduction, such as `cov`. This is ignored here. Closes numpygh-11331, numpygh-9393, numpygh-13734
Thanks! There's a good chance I wouldn't have opened #13734 if I had found this explanation on the page for the |
is only used when the summation is along the fast axis in memory. | ||
Note that the exact precision may vary depending on other parameters. | ||
In contrast to NumPy, Python's ``math.fsum`` function uses a slower but | ||
more precise approach to summation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding that for lower-precision floats such as f4
, one can pass in dtype='f8'
to increase precision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so, although it is growing so long... Maybe the real solution would be to have a longer paragraph about floating point rounding in the user guide and link that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Note that this behavour is of course inherited into
np.add.reduce
andmany other reductions such as
mean
or users of this reduction, suchas
cov
. This is ignored here.Closes gh-11331, gh-9393, gh-13734
To be honest, not sure I am too happy with it, but it is one of those things that comes up every couple of months.