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

Hypergeo fix #1510

Merged
merged 10 commits into from
Nov 13, 2024
Merged

Hypergeo fix #1510

merged 10 commits into from
Nov 13, 2024

Conversation

benjamin-lieser
Copy link
Collaborator

@benjamin-lieser benjamin-lieser commented Oct 12, 2024

  • Added a CHANGELOG.md entry

Summary

This is a fix for #1508
Thanks a lot to @WarrenWeckesser for finding it.

And it also replaces the very crude Stirling's approximation with something more precise without depending on a ln_gamma implementation.

Details

I do not have evidence that the stirling errors effect sampling in a big way, but I also do not have evidence that they do not and the error is quite big for small values.

For performance reasons we could shift by less than 3, but the LOGSQRT2PI correction is cheap and helps already a lot. The 1/12v term might also not matter that much.

Copy link
Member

@dhardy dhardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

rand_distr/src/hypergeometric.rs Outdated Show resolved Hide resolved
@dhardy dhardy merged commit 7fe350c into rust-random:master Nov 13, 2024
14 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