fslaborg / FSharp.Stats

statistical testing, linear algebra, machine learning, fitting and signal processing in F#
https://fslab.org/FSharp.Stats/
Other
210 stars 56 forks source link

Fix infinite loop bug in X² CDF #218

Closed omaus closed 2 years ago

omaus commented 2 years ago

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

Fixes #217

Please list the changes introduced in this PR

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

[Optional]

codecov-commenter commented 2 years ago

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%) :arrow_down:
src/FSharp.Stats/Fitting/Spline.fs 91.17% <0.00%> (-0.26%) :arrow_down:
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%) :arrow_up:

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.