Skip to content
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

Poisson distribution falls into an infinite loop for parameter λ=∞ #1290

Closed
Thopic opened this issue Feb 23, 2023 · 1 comment
Closed

Comments

@Thopic
Copy link
Contributor

Thopic commented Feb 23, 2023

When the parameter of the Poisson distribution is set to f64::INFINITY the sample function doesn't panic but instead loop and never stops. For example:

use rand_distr::{Poisson, Distribution};
fn main() {
    let lambda = f64::INFINITY;
    let poi = Poisson::new(lambda).unwrap();
    println!("{:?}", poi.sample(&mut rand::thread_rng()));
}
@dhardy
Copy link
Member

dhardy commented Feb 24, 2023

Sounds like Poisson::new should return an error (and the Error type wants an extra state for this).

A PR would be welcome (please include a note in the CHANGELOG).

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

2 participants