Repository navigation
Add checked Fp geometric inverse CDF support - #217
Merged
Merged
Conversation
Use outward-rounded fixed-point intervals to prove inverse-CDF comparisons at represented Fp probabilities. Bracket and search integer counts without relying on rounded CDF values or hardware logarithms, preserving full-width count arithmetic. Return explicit outcomes for proven counts, endpoint conventions, count limits, and unresolved precision. Preserve the existing endpoint precedence and provide conditional count extraction. Document the precision budget and handling of unresolved results. Add exact-rational references across Fp!64, Fp!128, and Fp!256, rounded-CDF counterexamples, and a stabilized large-count reference. Cover count-limit retries, precision exhaustion during bracketing and binary search, exponent-floor inputs, and parameter contracts. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Add geometricInvCDFChecked to the geometric distribution module and export it through the inverse-CDF convenience module. Publish the result and status types while retaining the bounded interval search in the internal implementation. Document the exact-count guarantee, endpoint precedence, inclusive size_t count limit, and fixed working-precision budget. Distinguish unresolved precision and finite counts beyond the limit from the existing infinity convention. Add public examples for conditional count extraction, count-limit retries, and endpoint and precision outcomes. Test Fp widths, parameter contracts, and compatibility with the existing hardware floating-point inverse. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Import Fp inside both examples so extracted documentation tests compile independently of the module-level imports. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Handle zero only at the search entry point; all comparator probes are positive. Remove the redundant branch and document that invariant. AI-Assisted-By: Codex (GPT-6 Astra Medium)
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.
Add
geometricInvCDFCheckedfor Fp probabilities, returning a proven integer quantile or an explicit endpoint, count-limit, or precision-limit outcome. Searching rounded CDF values can select the wrong count near a jump even when the CDF is correctly rounded; the checked inverse instead compares outward-rounded intervals against the exact represented query.Implementation
q == 1even whenp == 1.GeometricInverseResultandGeometricInverseStatus, with conditional count extraction throughtryGetCount.Limits
The inclusive count limit defaults to
size_t.max.countLimitproves that a finite quantile exceeds that limit; it does not mean infinity.Comparisons use
bits+128fractional bits, thenbits+512when necessary.precisionLimitreports an unresolved comparison and supplies no approximate count. Tiny probabilities near small-count jumps can reach this limit even when the quantile fits the count budget.Validation
Progress toward #157; this does not complete the broader Fp distribution work.
AI-Assisted-By: Codex (GPT-6 Astra Medium)