-
Notifications
You must be signed in to change notification settings - Fork 194
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
fixed floating point error #713
Conversation
Thanks for the PR! However, I'm not sure the docs should correspond exactly to the implementation. The docstring gives the mathematical formula, and the implementation is slightly different for performance reasons. Floating point approximations are generally not considered as significant. As was noted on Discourse, even |
Alright! Should I just mention floating-point precision or anything in the docstrings? Or should I close the PR? |
I think the existing version is fine. Separately from that, I also think this should be implemented with division instead of multiplication with the inverse. |
I also wondered whether using the inverse was really a good idea. I imagine it can only be faster if the range of levels is very wide compared with the number of values, but even then it's not obvious that it would make a big difference. @dnabanita7 Would you feel like checking whether using |
I think it is not making much difference with shorter collections.
It gives better performance with larger collections.
|
What are |
So, for the first case, x1, s1 are 7 element vector as in the output and for the second case x1, s1 is a random generated 5 * 10^8 element vector. As you can see in the second case, |
Hmm, I still don't get it. In general, posting code is more explicit. Anyway, (BTW, be careful when looking at the number of allocations with |
I meant that we should switch the implementation, not the docs. |
oh sure, right! |
cc @nalimilan |
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.
Thanks!
related to issue #712