feat: add stats/base/dists/log-logistic/cdf#11283
feat: add stats/base/dists/log-logistic/cdf#11283parthodas23 wants to merge 1 commit intostdlib-js:developfrom
stats/base/dists/log-logistic/cdf#11283Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
4899765 to
75d869b
Compare
72ff6d2 to
c66c194
Compare
|
Hey @parthodas23, pulling this down to review since I am also doing C-ports for distributions. Found a subtle numerical overflow issue in src/main.c around lines 51-52: If x or beta is large enough, xb will overflow to Infinity. In C, calculating Infinity / (1.0 + Infinity) will evaluate to NaN instead of capping at 1.0. You can actually prevent the overflow entirely by inverting the fraction analytically. If you compute it as: Then when x gets huge, alpha / x approaches 0.0, the denominator safely becomes 1.0, and the function returns 1.0 without any overflow or NaN issues. Hope this helps! Happy to review again once you update. |
|
@rautelaKamal How does SciPy compute this quantity? While you are correct regarding rearranging terms, it is not just boundary behavior we need to be concerned about. For example, how does the rearrangement fair in terms of accuracy against reference implementations for the entire domain? Ideally, we'd be consistent with other libraries, such as those in Python/Julia here. |
c66c194 to
e0d3687
Compare
|
@kgryte I check SciPy's implementation (_continuous_distns.py) and @rautelaKamal was correct. I've updated src/main.c to use |
e0d3687 to
b068d1e
Compare
b068d1e to
63392b6
Compare
Resolves none
Description
This pull request:
stats/base/dists/log-logistic/cdfRelated Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers