-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Percent sign ignores parenthesis #273
Comments
Do you any suggestion to resolve the problem ? I want to read some ideal to resolve one. |
The |
Do you know any algorithm to discuss about this topic ? I used the Google’s Calculator, it works well. So, I want to develop one. But, currently, I don’t have any solution to resolve. By the way, Which algorithm you used to evaluate the expression string ? As the shunting yard algorithm ?
… On 11 May 2023, at 16:41, Mateusz Zmuda ***@***.***> wrote:
The +x% is generally a problematic way of using the percent sign, as it's not mathematically defined. But you could stick to the idea that the percent doesn't mean just ÷100 only when it's directly following a number, and that number is a direct part of some sum/substraction. Then before parsing the equation you enclose all previous elements of this sum in parenthesis, and change the +x% to ×(1+x÷100). However, I don't know how this calculator parses it's input, so maybe there's a better solution.
—
Reply to this email directly, view it on GitHub <#273 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADIQB26P2HH52HKT6OMFIETXFSX27ANCNFSM6AAAAAAXDZ36LM>.
You are receiving this because you commented.
|
The problem is with the function that create the expression https://github.com/Darkempire78/OpenCalc/blob/main/app/src/main/java/com/darkempire78/opencalculator/Expression.kt#L43 |
fixed by #507 |
The percent sign seems to have a higher precedence than parenthesis, which seems... wrong...
The text was updated successfully, but these errors were encountered: