Skip to content

Conversation

@benjamin-lieser
Copy link
Member

@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

@dhardy dhardy merged commit 7fe350c into rust-random:master Nov 13, 2024
@benjamin-lieser benjamin-lieser deleted the hypergeo_fix branch November 15, 2024 17:31
benjamin-lieser added a commit to benjamin-lieser/rand that referenced this pull request Feb 5, 2025
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