Skip to content

Manual type promotion for arcsine distribution#1373

Merged
jzmaddock merged 7 commits intoboostorg:developfrom
JacobHass8:dist-maintenance
Mar 15, 2026
Merged

Manual type promotion for arcsine distribution#1373
jzmaddock merged 7 commits intoboostorg:developfrom
JacobHass8:dist-maintenance

Conversation

@JacobHass8
Copy link
Copy Markdown
Contributor

This tries to rewrite #1299 in a more human readable way. See #1294 for the same issue with the logistic distribution.

@JacobHass8
Copy link
Copy Markdown
Contributor Author

@mborland what do you think of this version? I made a number of actual changes to the code that I'd like to get your opinion on. I left comments below.

On an unrelated note, I wasn't able to get b2 to run test_arcsine. I was getting more errors than I could count. Is it set up to run or is it skipped for some reason?

Comment thread include/boost/math/distributions/arcsine.hpp
Comment thread include/boost/math/distributions/arcsine.hpp
Comment thread include/boost/math/distributions/arcsine.hpp Outdated
Comment thread include/boost/math/distributions/arcsine.hpp Outdated
@mborland
Copy link
Copy Markdown
Member

mborland commented Mar 6, 2026

On an unrelated note, I wasn't able to get b2 to run test_arcsine. I was getting more errors than I could count. Is it set up to run or is it skipped for some reason?

It is setup to run, and I just tried it on head and the test ran fine. What's the issue? You can try pch=off if you're getting a bunch of errors propagating from the usage of pre-compiled headers.

@mborland
Copy link
Copy Markdown
Member

mborland commented Mar 6, 2026

I do think this approach looks better. Thanks!

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 98.57143% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.35%. Comparing base (e6fb7d3) to head (8e919f2).
⚠️ Report is 21 commits behind head on develop.

Files with missing lines Patch % Lines
include/boost/math/distributions/arcsine.hpp 98.38% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1373      +/-   ##
===========================================
+ Coverage    95.34%   95.35%   +0.01%     
===========================================
  Files          825      825              
  Lines        68160    68175      +15     
===========================================
+ Hits         64986    65010      +24     
+ Misses        3174     3165       -9     
Files with missing lines Coverage Δ
include/boost/math/policies/policy.hpp 95.83% <ø> (ø)
test/test_arcsine.cpp 99.18% <100.00%> (+0.02%) ⬆️
include/boost/math/distributions/arcsine.hpp 96.11% <98.38%> (+4.78%) ⬆️

... and 1 file 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 e6fb7d3...8e919f2. Read the comment docs.

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

@JacobHass8
Copy link
Copy Markdown
Contributor Author

On an unrelated note, I wasn't able to get b2 to run test_arcsine. I was getting more errors than I could count. Is it set up to run or is it skipped for some reason?

It is setup to run, and I just tried it on head and the test ran fine. What's the issue? You can try pch=off if you're getting a bunch of errors propagating from the usage of pre-compiled headers.

There were just a ton of errors in my code. I missed a couple of closing brackets which caused a large amount of errors.

@JacobHass8
Copy link
Copy Markdown
Contributor Author

@mborland and @jzmaddock I think this is ready to merge as long as neither of you see any other issues.

Do these changes need to be applied to every distribution in the distribution folder?

@JacobHass8
Copy link
Copy Markdown
Contributor Author

@mborland and @jzmaddock just pinging you guys to let you know this PR is ready to merge.

@jzmaddock
Copy link
Copy Markdown
Collaborator

Do these changes need to be applied to every distribution in the distribution folder?

No, in general most of the distributions are fairly trivial wrappers around some special function or other, so all the argument promotion stuff is handled there anyway.

There are a small number (possibly just this one, not sure) of distributions which use trivial arithmetic or std lib functions only, and for those we couldn't really see the point in jumping through all the hoops of applying the type promotion policies. I'm not necessarily convinced it'll have much if any effect on this one either to be honest given the calculations are so simple and error rates so low, but there we go...

Thanks for this, merging...

@jzmaddock jzmaddock merged commit c52fc09 into boostorg:develop Mar 15, 2026
65 checks passed
@JacobHass8
Copy link
Copy Markdown
Contributor Author

No, in general most of the distributions are fairly trivial wrappers around some special function or other, so all the argument promotion stuff is handled there anyway.

There are a small number (possibly just this one, not sure) of distributions which use trivial arithmetic or std lib functions only, and for those we couldn't really see the point in jumping through all the hoops of applying the type promotion policies. I'm not necessarily convinced it'll have much if any effect on this one either to be honest given the calculations are so simple and error rates so low, but there we go...

Ah, that makes sense to me. #1299 added the manual promotion for the Beta and Bernoulli distribution. @mborland are their any other distributions that you know which have this issue? I'll do this for the Beta and Bernoulli distribution and take a look at the other distributions.

@jzmaddock
Copy link
Copy Markdown
Collaborator

Just curious, what do you guys think needs to change in the beta distribution? It's just a thin wrapper around the ibeta family of functions?

@mborland
Copy link
Copy Markdown
Member

Just curious, what do you guys think needs to change in the beta distribution? It's just a thin wrapper around the ibeta family of functions?

There are a couple of functions like variance and skewness that are direct calculations rather than wrappers. I honestly don't know how much this stuff matters, especially on newer GCC where promotion is already happening on their end.

@JacobHass8
Copy link
Copy Markdown
Contributor Author

Hmmmm, if this isn't that high of a priority are there any other projects I could work on for the time being?

@mborland
Copy link
Copy Markdown
Member

Hmmmm, if this isn't that high of a priority are there any other projects I could work on for the time being?

Depending on the scale of what you're looking for we have a pinned feature wishlist. If you're interested the last open feature request from the SciPy guys would be helpful: #303 (comment)

@mborland
Copy link
Copy Markdown
Member

Something smaller that would also be super helpful is getting the lib to run with -Wall or -Wextra and -Werror. I did some way back, but you'll still see your terminal rapidly fill with warnings if you run the test suites.

@ckormanyos
Copy link
Copy Markdown
Member

ckormanyos commented Mar 23, 2026

getting the lib to run with -Wall or -Wextra and -Werror. I did some way back

I'm happy to read this suggestion. It is another world, the fascinating drive toward quality, offering tangible and long-lasting results. We have worked on warning reduction (and of course all quality aspects) for years now.

I've worked on this also from time to time over the years.

  • When you ramp up quality, you can start with an initial basic level like -Wall, -Wextra and -Wpedantic.
  • Then ramp up to -Wconversion and -Wsign-conversion.
  • Then add more details like -Wshadow.

Formal correctness adds quite a bit more than you might think at the outset and really helps with portability and long-term maintenance.

@jzmaddock
Copy link
Copy Markdown
Collaborator

There is also the (probably never ending and never finished) job of improving our testing coverage.

I started going through all the special functions with the aim of getting to 100% coverage on all of them, if you look down a recent PR run and drill down you'll see: https://app.codecov.io/gh/boostorg/math/pull/1379/tree/include/boost/math/special_functions?dropdown=coverage where there are lots of 100%'s but a few that have recently dropped below that :(

I also haven't got into the special_functions/detail directory yet where there are lots with low coverage currently.

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.

4 participants