Skip to content

Recursion Test - Part 1 (Exponent) #55

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

Closed
asalem1 opened this issue Jun 5, 2017 · 6 comments
Closed

Recursion Test - Part 1 (Exponent) #55

asalem1 opened this issue Jun 5, 2017 · 6 comments

Comments

@asalem1
Copy link

asalem1 commented Jun 5, 2017

First off, I wanted to say thanks for setting this up, it's been a huge help in practicing recursion! I just wanted to point out a slight issue with one of the tests (lines 435-440) in Part I. A negative base with an even exponent will yield a positive number.

it('should accept negative integer for base', function() {
expect(exponent(-3,4)).to.equal(-81); //should be 81
expect(exponent(-12,5)).to.equal(-248832);
expect(exponent(-7,2)).to.equal(-49); //should be 49
expect(exponent(-7,4)).to.equal(-2401); //should be 2401
});

@mybrainishuge
Copy link
Contributor

Hey, @asalem1 glad you're enjoying the repo! I concede to your math. Since JS is known to struggle with math, I suspect I used Google or some other calculator and failed to include parens around the negative number. Note the difference:
https://www.google.com/#q=-3^4
https://www.google.com/#q=(-3)^4

Would you like to make a PR with the fix?

@ejk91
Copy link
Contributor

ejk91 commented Jun 13, 2017

If @asalem1 doesn't mind, I can submit a PR with the fix!

@mybrainishuge
Copy link
Contributor

That'd be great, @ejk91 !

@ejk91
Copy link
Contributor

ejk91 commented Jun 14, 2017

PR submitted!

@mybrainishuge
Copy link
Contributor

Thanks, @ejk91 ! PR #56 has been merged.

@asalem1
Copy link
Author

asalem1 commented Jun 14, 2017

@mybrainishuge Sorry about that, not sure how I didn't see the notification. Happy to hear it all worked out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants