Skip to content

phobos#10826 address Q1 cases where near origin or near infinity#10890

Merged
thewilsonator merged 4 commits intodlang:stablefrom
tedgin:10826
Nov 5, 2025
Merged

phobos#10826 address Q1 cases where near origin or near infinity#10890
thewilsonator merged 4 commits intodlang:stablefrom
tedgin:10826

Conversation

@tedgin
Copy link
Contributor

@tedgin tedgin commented Nov 4, 2025

This adds support to std.mathspecial.beta(x, y) for the cases when (x,y) is in the first quadrant and near the origin, or the larger of x and y is very large. These were missed in the original merge request I made for issue #10826.

This also fixes the NaN handling so that it works the same way as x + y. When both x and y are NaN, the one with the larger payload is returned.

This modifies the beta function so that it explicitly addresses the case
where the input parameters (x,y) are (+0,+0), i.e. next to the origin in
the first quadrant. This is already implicitly handled, but explicitly
handling it will be make the algoritm clearer when it is extended to
address the cases where x is very small and y is very small or very
large.

Since the cases are numbered, I had to renumber the cases. (Maybe I
shouldn't have numbered them originally.)
This adds support for the cases when (x,y) is in the first quadrant
and  near the origin or the larger of x and y is very large
This changes the NaN handling behavior of beta to be the same as that of
the + operator, i.e., when both input arguments are NaN, the one with
the larger payload is returned.
@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#10890"

@thewilsonator thewilsonator merged commit b0bb590 into dlang:stable Nov 5, 2025
9 of 10 checks passed
@tedgin tedgin deleted the 10826 branch November 5, 2025 14:23
This was referenced Mar 20, 2026
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.

3 participants