-
Notifications
You must be signed in to change notification settings - Fork 34
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
-3^(1*2) wrong result #64
Comments
🎉 This issue has been resolved in version 2.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
-3^(1*2) should be returning 9 and i have fixed it. Thanks for informing! |
I think the problem remains (in version 2.0.1): |
working fine here: https://jsbin.com/romatuc/edit?html,output Make sure that you actually are on 2.0.1 |
In school we learn (-3)^2=9 and -3^2=-(3^2)=-9. I understand that you want the unary operator '-' to have a bigger priority than operator '^', but it is not something that we find frequently. If you keep this convention, look the problem: All of us know that a-b=a+(-b), so 9-3^2=9+(-3^2) and although the two previous expressions are equal, your script evaluates the first expression to 0 and the second to 18. Check it. |
I am no mathematician ^_^ but I agree with you. May you try now at version 2.0.2. Actually, the second last message with -4, -6 got me confused a bit in understading your point. This change is passing all of the tests but I hope it does not break anything |
It returns -6. It should return -9.
Also -3^(1+1) returns -4. It should return -9. But 0-3^(1+1) return correct answers. (The same for the first example)
The text was updated successfully, but these errors were encountered: