Yet-Zio / yetCalc

Yet another calculator designed and developed for Android
BSD 3-Clause "New" or "Revised" License
204 stars 17 forks source link

App can't add/subtract percentages properly #28

Closed ExperiencersInternational closed 1 year ago

ExperiencersInternational commented 1 year ago

So, I really wanted to use this to replace the stock Xiaomi calculator, which I had replaced with the Google calculator, but the app cannot even calculate adding or subtracting percentages properly (I'm guessing it's just calculating the percentage in 1?).

Screenshot_2023-01-14-22-27-56-147_yetzio yetcalc Screenshot_2023-01-14-22-27-47-340_yetzio yetcalc

Yet-Zio commented 1 year ago

Hi @ExperiencersInternational thanks for the report. First I thought this might be an issue because of the updates I did to the calculator component. But, seems like this is how mXparser, the library that the calculator mode uses handles percentages. Yea it calculates the percentage in 1. Funny enough, I didn't notice this. I will probably have to ask the library author for this one. Sorry for any inconvenience.

Yet-Zio commented 1 year ago

Hello @ExperiencersInternational, I have received a reply from mXparser's author. mXparser takes a more correct math perspective for the syntax similar to excel. For your case 5-20% can be calculated simply by 5-20%5 or 5+20%5. Like if you do 2% * 100, it will be 2% of 100. By default the percentage operator calculates in 1. I hope that solves your issue.