Skip to content

10823 fix, fixed sign of beta(x,y) when x+y large #10824

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

Merged
merged 2 commits into from
Aug 11, 2025

Conversation

tedgin
Copy link
Contributor

@tedgin tedgin commented Jul 26, 2025

When x > MAXGAMMA or y > MAXGAMMA and the other argument is negative, std.mathspecial.beta now correctly computes the sign of B(x,y). See #10823 for more details.

@tedgin tedgin requested a review from ibuclaw as a code owner July 26, 2025 17:08
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @tedgin! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + phobos#10824"

@tedgin
Copy link
Contributor Author

tedgin commented Jul 26, 2025

I don't understand the failure. I need help, because it doesn't appear to have happened in the code I changed.

@thewilsonator
Copy link
Contributor

Seems to be caused by dlang/dmd#21523 I'd guess. Try rebasing?

@tedgin
Copy link
Contributor Author

tedgin commented Jul 31, 2025

That's a bug fix in a different repository. My PR is already on top of the head of phobos's stable branch. Are you suggesting I rebase on phobos's master branch?

@pbackus
Copy link
Contributor

pbackus commented Jul 31, 2025

Anything merged into Phobos' stable branch has to be compatible with DMD's stable branch. Phobos' master branch does not share this requirement. So if you want to merge a PR into Phobos that depends on a bugfix in DMD's master branch, your options are to either (a) merge your PR into Phobos's master branch, or (b) backport the DMD bugfix from DMD's master branch to DMD's stable branch.

@tedgin
Copy link
Contributor Author

tedgin commented Jul 31, 2025

Thank you. That makes sense. I'm already using the stable branch of dmd when I test the PR locally without error.

All seven checks are failing in the "Test DMD" section when building compilable/test3004.d on github. I had assumed the phobos library tests would be in the "Test Phobos" section. Can changes to phobos cause DMD tests to breaK? I'm sorry to be such a nube.

@pbackus
Copy link
Contributor

pbackus commented Jul 31, 2025

Can changes to phobos cause DMD tests to break?

They're not supposed to, but in practice, yes, they can.

@tedgin
Copy link
Contributor Author

tedgin commented Aug 2, 2025

Following the DLang Contributor Tutorials on YouTube, specifically the 2nd video, I can reproduce the failure reported by the github checks. I'm using the head of stable on both dmd and phobos without my changes.

Here are the steps that I performed from the video.

dmd/compiler/src? rdmd build.d DEBUG=build
# output elided
dmd/compiler/test? rdmd run.d DEBUG=build compilable/test3004.d
# most output elided
>>> TARGET FAILED: compilable/test3004.d
FAILED targets:
- compilable/test3004.d

Since my code isn't part of the build, I think the bug is in the stable branch of dmd.

This is my first time performing dmd tests locally, so I apologize in advance if I boned it.

@0xEAB
Copy link
Member

0xEAB commented Aug 2, 2025

Thanks for pointing this out, @tedgin!
I’ve filed an issue for DMD: dlang/dmd#21636

@tedgin
Copy link
Contributor Author

tedgin commented Aug 4, 2025

I missed a case. Will fix and resubmit.

Fix the large value method of computing std.mathspecial.beta so that it
recovers the signs of gamma(x), gamma(y), and gamma(x+y).
@tedgin
Copy link
Contributor Author

tedgin commented Aug 10, 2025

Is this being reviewed yet? I'm sorry if I'm pinging too early, but I think I read somewhere to ping after three days of inactivity.

@thewilsonator thewilsonator merged commit c348c30 into dlang:stable Aug 11, 2025
10 checks passed
@tedgin tedgin deleted the 10823 branch August 11, 2025 10:58
tedgin added a commit to tedgin/phobos that referenced this pull request Aug 11, 2025
Fix the large value method of computing std.mathspecial.beta so that it
recovers the signs of gamma(x), gamma(y), and gamma(x+y).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std.mathspecial.beta(x,y) generates answer with wrong sign sometimes when x is negative and x+y is large
5 participants