-
Notifications
You must be signed in to change notification settings - Fork 242
Fix for scipy issues 18506 and 18511 #987
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
@jzmaddock Can you please take a look at this? |
OK this is nearly right (but see below). The changes to use [u]int64_t are fine. However, matching changes are required in detail/hypergeometric_pdf.hpp, detail/hypergeometric_cdf.hpp and detail/hypergeometric_quantile.hpp otherwise the arguments will simply get narrowed to The changes to some of the functions are not, consider the original version of variance:
This I think does the right thing - which is to say carry out all computations as floating point arithmetic, and your changes I think break that. The reason the old
So that should use a bit of casting as per the original variance implementation to carry out FP arithmetic not integer. Now for the open question: I assume that we're calculating the complement of the CDF here? And that the OP in scipy/scipy#18506 is just upping the population size until some limit is reached (or something breaks)? If so then using int64_t will help, but we will still break in the end... but I'm conflicted here because the arguments are logically integers! |
Hit all of the changes in the latest commit.
I think like #939 we try bumping it up to |
+1 for changing the type to On the SciPy side, we need to ensure that Python integers that are too large to be represented as 64 bit integers are handled appropriately instead of allowing them to end up in 64 bit variables. |
@jzmaddock The only CI failure is fail to clone so this should be good if you want to take another look. |
Looks good to me - we just need to update the docs to |
All of the member variables of the hyper geometric distribution were of type
unsigned
leading to overflow whenn*N
exceededUINT_MAX
. Replace them withstd::uint64_t
. Similar to #939x-ref: scipy/scipy#18506 and scipy/scipy#18511