8000 Incorrect nan handling in multiple random generators · Issue #13283 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Incorrect nan handling in multiple random generators #13283

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

Closed
bashtage opened this issue Apr 8, 2019 · 2 comments
Closed

Incorrect nan handling in multiple random generators #13283

bashtage opened this issue Apr 8, 2019 · 2 comments

Comments

@bashtage
Copy link
Contributor
bashtage commented Apr 8, 2019

Many distributions accept nans but do not produce correct results.

np.random.vonmises(1., np.nan) goes into an infinite loop
np.random.geometric(np.nan) returns np.iinfo(np.int).min
np.random.poisson(np.nan) returns 0
np.random.negative_binomial returns 0
np.random.logseries returns 2
np.random.noncentral_f(1.0, 2.0, np.nan)' returns the same as np.random.noncentral_f(1.0, 2.0, 1.)since it relies onpoissonwhich returns0`.

Fixing most of these to raise would probably be OK. The only one that is tricky is noncentral_f which needs a nan-guard inserted at the bottom of the rk_noncentral_f so that the stream is preserved (it essentially draws non-sense values and then returns nan`.

Probably not worth fixing these now. They have been fixed in #13163. Related to #13189 since fixing this issue lead to this discovery. That issue is also fixed in #13163, although there is no test for it.

@bashtage
Copy link
Contributor Author
bashtage commented Jun 2, 2019

This might be fixed. #13164

@bashtage
Copy link
Contributor Author
bashtage commented Jun 2, 2019

@mattip Fixed in master.

@bashtage bashtage closed this as completed Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0