-
-
Notifications
You must be signed in to change notification settings - Fork 553
rational-numbers
missing test case for negative rational exponent
#1909
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
Comments
It appears that there are only two tests for this case and they both use a positive integer power. No negative integer power as you mentioned. It would seem valuable to create a test implementation for it. Even though it is not stated in the problem description, there is also no test for taking a negative real number and raising it to a rational power.
If x were to be less than zero (negative), and r = a/b, where b is even, this would result in complex roots. If b is odd, it is ok to take the odd roots of negative numbers, as it preserves the sign. It may be a valuable lesson when implementing this particular method/function. Thoughts? |
Correct understanding. Adding a test for negative integer power would be good. A UUID may be generated with any tool of your choice that generates version 4 UUIDs, even those that are available as a webpage on the internet. For consideration of negative real numbers raised to rational powers, I suggest a separate issue. |
Thanks @ericbalawejder and @petertseng ! I've created PR #1914 just for the negative integer tests. |
The problem description states:
However this is not checked for in the tests.
As such, the tests pass even if the implementation does something like
Would my understanding be correct? I'm happy to raise PR and add a test, just that I don't know how to generate UUID for it 😅
(thanks @angelikatyborska for suggesting raising an issue)
The text was updated successfully, but these errors were encountered: