Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loop bug in X² CDF #218

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

omaus
Copy link
Contributor

@omaus omaus commented Jun 23, 2022

Please reference the issue(s) this PR is related to

Fixes #217

Please list the changes introduced in this PR

  • Bug fixed when using ChiSquared.CDF with arbitrary dof and x being nan

Description

When using the CDF in a ChiSquared distribution with input value nan, Gamma.lowerIncomplete resp. gcf goes into infinite loop.
CDF function now checks for input being nan and returning nan if so.

[Required] please make sure you checked that

  • [×] The project builds without problems on your machine (and bugfix works, too)

[Optional]

  • Added unit tests regarding the added features (will be done in near future)

When using the CDF in a ChiSquared distribution with input value `nan`, `Gamma.lowerIncomplete` resp. `gcf` goes into infinite loop.
CDF function now checks for input being `nan` and returning `nan` if so.
@omaus omaus mentioned this pull request Jun 27, 2022
2 tasks
@codecov-commenter
Copy link

Codecov Report

Merging #218 (b83b8a7) into developer (262f1ac) will increase coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           developer     #218   +/-   ##
==========================================
  Coverage      31.61%   31.62%           
==========================================
  Files            124      124           
  Lines          11664    11658    -6     
  Branches        1784     1785    +1     
==========================================
- Hits            3688     3687    -1     
+ Misses          7535     7529    -6     
- Partials         441      442    +1     
Impacted Files Coverage Δ
src/FSharp.Stats/Distributions/Continuous.fs 15.85% <0.00%> (-0.04%) ⬇️
src/FSharp.Stats/Fitting/Spline.fs 91.17% <0.00%> (-0.26%) ⬇️
src/FSharp.Stats/Array.fs 0.00% <0.00%> (ø)
...tats/ML/Unsupervised/PrincipalComponentAnalysis.fs 0.00% <0.00%> (ø)
src/FSharp.Stats/Ops.fs 4.00% <0.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

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

@bvenn bvenn merged commit 6c23e4b into fslaborg:developer Jun 27, 2022
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.

[BUG] Infinite loop in ChiSquared.CDF when input is nan
3 participants