Skip to content

Replace poisson implementation#55

Merged
henrygarner merged 1 commit intoMastodonC:mainfrom
tggreene:main
Nov 10, 2025
Merged

Replace poisson implementation#55
henrygarner merged 1 commit intoMastodonC:mainfrom
tggreene:main

Conversation

@tggreene
Copy link
Copy Markdown
Contributor

Solves an issue with the knuth poisson algorithm for large lambdas around 700 and above, where sampled values could only grow to around 700.

Essentially for large lambdas the negative exponent becomes very small and underflows to zero, which means the loop returns very small values.

This change uses the normal approximation to the Poisson distribution for lambdas >= 50, chosen because a gaussian variable is an extremely close approximation of poisson for lambda values >= 50.

Solves an issue with the knuth poisson algorithm for large lambdas around 700
and above, where sampled values could only grow to around 700.

Essentially for large lambdas the negative exponent becomes very small and
underflows to zero, which means the loop returns very small values.

This change uses the normal approximation to the Poisson distribution for
lambdas >= 50, chosen because a gaussian variable is an extremely
close approximation of poisson for lambda values >= 50.
@henrygarner henrygarner merged commit a1e531f into MastodonC:main Nov 10, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants