-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Geometric, negative binomial and poisson fail for extreme arguments (Trac #896) #1494
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
Comments
Attachment added by trac user anand on 2008-08-29: distributions.patch |
trac user anand wrote on 2008-08-29 File distributions.patch 'fixes' it by setting doubles to LONG_MAX if they can't be cast to long... I know it's debatable whether this is actually better. |
Attachment added by trac user anand on 2008-08-29: double.patch.zip |
trac user anand wrote on 2008-08-29 Double.patch.zip makes the problem a little better by making geometric, poisson and negative_binomial return doubles. |
Attachment added by trac user anand on 2008-08-29: check_bounds.patch |
trac user anand wrote on 2008-08-29 And check_bounds.patch raises an error if the absolute value of the return value is LONG_MAX. |
@teoliphant wrote on 2008-08-29 Do we want to be raising an error if any of the entries overflow? This is different array behavior than usual. |
@rkern wrote on 2008-08-29 The way I have been fixing these problems is to simply reject the result if it is out of bounds and resample until I do get something in bounds. The generators then sample a slightly modified form of the distribution which is truncated to the limits of the output representation. Since this is basically the deal you make with any computerized non-uniform RNG, I'm fairly comfortable with it. |
@rkern wrote on 2008-08-29 But I do want to get 1.2.0 out first. I think these can wait. |
Milestone changed to |
trac user anand wrote on 2008-09-01 If the standard array behavior is to set to -LONG_MAX-1 when casting to long fails, it makes sense for the RNG's to conform... but isn't that a C gotcha that numpy should protect against like it does with array bounds checking? |
Milestone changed to |
@charris wrote on 2010-05-25 Has this been fixed? I recall some discussion of this on the list. |
Milestone changed to |
@mwiebe wrote on 2011-03-23 Except for poisson, it's still basically the same (but LONGLONG_MIN instead on a 64-bit system):
|
Milestone changed to |
These problems look to be fixed. @joseph-pkt, @rkern Comments? |
I don't have a 32-bit build handy to test. |
It's still an issue.
|
Shoot :( |
Still producing |
What's the new API?? |
There still seem to be overflow/underflow problems even in the new API:
In particular the "tipover"-point depends on p. For p=0.5 it's at 9223372037481356287 (so This has been verified on python 3.8.3, numpy version 1.18.5 and 1.17.4 running on linux mint 20 as well as python 3.8.5, numpy version 1.19.2 running on macOS Big Sur (Version 11.3). The code samples don't raise an error regardless of |
Original ticket http://projects.scipy.org/numpy/ticket/896 on 2008-08-29 by trac user anand, assigned to @rkern.
I'm guessing these are all related and have something to do with overflow:
The text was updated successfully, but these errors were encountered: