Skip to content
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

Fix Issue 7006 - std.math.pow (integral, integral) crashes on negative exponents #7322

Merged
merged 1 commit into from Jan 3, 2020
Merged

Conversation

ghost
Copy link

@ghost ghost commented Dec 16, 2019

I improved the docs too, including the public unittest.

@ghost ghost requested a review from ibuclaw as a code owner December 16, 2019 08:11
@dlang-bot
Copy link
Contributor

dlang-bot commented Dec 16, 2019

Thanks for your pull request and interest in making D better, @berni44! 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

Auto-close Bugzilla Severity Description
7006 regression std.math.pow (integral, integral) crashes on negative exponents

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

To target stable perform these two steps:

  1. Rebase your branch to upstream/stable:
git rebase --onto upstream/stable upstream/master
  1. Change the base branch of your PR to stable

Testing this PR locally

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

dub fetch digger
dub run digger -- build "master + phobos#7322"

Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

Otherwise looks good.

std/math.d Outdated Show resolved Hide resolved
std/math.d Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Dec 25, 2019

I do not understand, why this always fails on ci/circleci. First I thought it is unrelated, but meanwhile the error was reproduced with each run: std/range/package.test fails. When I run that test locally it succeeds (but needs about 6 minutes). What does ci/circleci actually do?

@thewilsonator
Copy link
Contributor

Circle is green now, but mir/algorithm still fails consistently.

@ghost
Copy link
Author

ghost commented Jan 3, 2020

Circle is green now, but mir/algorithm still fails consistently.

Found (and fixed) the problem: m <= -1 is not a good idea, when m is unsigned. I added also a unittest (assert(pow(0,uint.max) == 0);) to guard for that problem. (There are two more expressions I put into static if, but that is mere for extra security; IMHO they could not break and therefore I could not add a guarding unittest for them.)

@dlang-bot dlang-bot merged commit bb8ba28 into dlang:master Jan 3, 2020
tramker pushed a commit to tramker/phobos that referenced this pull request Jul 24, 2020
Fix Issue 7006 - std.math.pow (integral, integral) crashes on negative exponents
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>

Signed-off-by: Martin Krejcirik <mk@krej.cz>
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.

3 participants