-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Description
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 on
poissonwhich returns
0`.
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.