Skip to content

Avoid division by 0 in beta_distribution operator()#134

Merged
mborland merged 2 commits into
developfrom
133
Jun 30, 2025
Merged

Avoid division by 0 in beta_distribution operator()#134
mborland merged 2 commits into
developfrom
133

Conversation

@mborland

Copy link
Copy Markdown
Member

Closes: #133

@codecov

codecov Bot commented Jun 30, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.85%. Comparing base (59a5eb8) to head (c98dc05).
Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #134      +/-   ##
===========================================
+ Coverage    95.83%   95.85%   +0.01%     
===========================================
  Files          114      115       +1     
  Lines         8115     8126      +11     
===========================================
+ Hits          7777     7789      +12     
+ Misses         338      337       -1     
Files with missing lines Coverage Δ
include/boost/random/beta_distribution.hpp 100.00% <100.00%> (ø)
test/github_issue_133.cpp 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59a5eb8...c98dc05. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mborland

Copy link
Copy Markdown
Member Author

The loop here keeps the shape of the distribution intact. I tried a simpler if (a == 0) return 0, but that skewed the distribution left.

@mborland
mborland merged commit 3289126 into develop Jun 30, 2025
41 checks passed
@mborland
mborland deleted the 133 branch June 30, 2025 17:41
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.

beta_distribution produces nan values sometimes when given small (close to zero) parameters

1 participant