Skip to content

Fix lower incomplete gamma functions with x = 0 #1251

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

cohomology
Copy link

In this case, the errno error handling did not work correctly, as internal functions where accidently setting it, although no overflow happens.

Fixes #1249.

In this case, the errno error handling did not work correctly,
as internal functions where accidently setting it, although no
overflow happens.

Fixes boostorg#1249.
Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 98.55072% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.82%. Comparing base (a5c0625) to head (7503be4).

Files with missing lines Patch % Lines
test/git_issue_1249.cpp 98.38% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1251      +/-   ##
===========================================
- Coverage    93.83%   93.82%   -0.01%     
===========================================
  Files          657      658       +1     
  Lines        55244    55330      +86     
===========================================
+ Hits         51840    51916      +76     
- Misses        3404     3414      +10     
Files with missing lines Coverage Δ
include/boost/math/special_functions/gamma.hpp 92.08% <100.00%> (-0.18%) ⬇️
test/git_issue_1249.cpp 98.38% <98.38%> (ø)

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -1627,7 +1631,7 @@ BOOST_MATH_GPU_ENABLED T gamma_incomplete_imp_final(T a, T x, bool normalised, b
#endif
result = gam - result;
}
if(p_derivative)
if(p_derivative && x > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to let this line execute without the check for x > 0, that way our root finder will get a derivative back: in this particular case, any arbitrary large value will do.... ah but there should be an else before the *p_derivative /= x;.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I adjusted the coding. Is it okay now?

I also corrected some wrong ternary operators in the file which prevent using some functions with non-standard float/double T template parameters.

@jzmaddock
Copy link
Collaborator

Other than my one small comment, this all looks good. Many thanks for this!

@jzmaddock
Copy link
Collaborator

Looks great, thanks, just running CI now...

@cohomology
Copy link
Author

Where are these CI errors come from? I don't get them ...

@mborland
Copy link
Member

Where are these CI errors come from? I don't get them ...

The Cauchy one was failing with the SYCL compiler, and the beta ones are new failure there that are unrelated. The last one is we need to increment the current version in Boost.Config. I would not worry about any of these failures. I need to address them, and make sure we haven't broken CUDA along the way

@jzmaddock
Copy link
Collaborator

Ah shucks, sorry, I hadn't spotted that the new beta tests were failing on CUDA. @mborland some of them are trivial failures (need to update expected error rates), but there are a few "gross" errors which might warrant investigation. Or it may be that the inputs are so extreme that there's not much we can do on that platform. If you have CUDA/Sycl set up can I let you investigate?

@mborland
Copy link
Member

Ah shucks, sorry, I hadn't spotted that the new beta tests were failing on CUDA. @mborland some of them are trivial failures (need to update expected error rates), but there are a few "gross" errors which might warrant investigation. Or it may be that the inputs are so extreme that there's not much we can do on that platform. If you have CUDA/Sycl set up can I let you investigate?

Yes, next week I'll look into these. The Scipy guys also are in a position now to use the CUDA stuff so I'll put some effort into the rest of the library too.

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.

Wrong result for lower incomplete gamma function and x = 0
3 participants