Repository navigation
Handle degenerate negative-binomial parameters before sampling - #169
Open
trestoncuzzort wants to merge 2 commits into
Open
trestoncuzzort wants to merge 2 commits into
trestoncuzzort wants to merge 2 commits into
Conversation
mborland
approved these changes
Nov 2, 2026
mborland
left a comment
Member
There was a problem hiding this comment.
Looks good to me. Once the CI runs green I will merge. Thank you!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #169 +/- ##
===========================================
+ Coverage 96.18% 96.21% +0.02%
===========================================
Files 129 130 +1
Lines 8446 8504 +58
===========================================
+ Hits 8124 8182 +58
Misses 322 322
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Return zero without using the engine when k is zero or p is one. Clarify that positive k requires p > 0 and assert that precondition before computing the gamma scale. Preserve the interior sampling path. Cover the boundary cases through construction, parameter changes, explicit parameters and streaming for several integer and real types. Generated-by: OpenAI Codex
mborland
force-pushed
the
negative-binomial-boundary-cases
branch
from
November 3, 2026 18:52
b1241dd to
117e344
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #63.
negative_binomial_distribution(0, 0.5)and(10, 1)satisfy the documented preconditions but abort in the gamma constructor.(0, 0)divides by zero before reaching that constructor.Return zero directly when the target count is zero or the success probability is one. These cases need no random draws. For a positive target, clarify that the success probability must be strictly positive, and assert that generation precondition before dividing. The interior gamma-Poisson path is unchanged.
Extend the existing tests across signed/unsigned integer and floating representations, direct/parameter construction, parameter setters, explicit-parameter generation and stream round trips. Check both the zero results and unchanged engine state.
Validation on Linux:
git diff --checkpasses. Native Windows/32-bit builds and generated documentation were not tested.OpenAI Codex assisted with investigation, implementation and tests. dawnr checked the boundary guard's gamma-parameter conditions using an exact rational abstraction and seven provers; that does not prove floating-point sampling or the generic/compiled C++ implementation.