Yet-Zio / yetCalc

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

percentage(concern about intended behavior) #41

Closed Wjxfi closed 1 year ago

Wjxfi commented 1 year ago

opencalc vs yetcalc 312148.jpg 312154.jpg 312157.jpg 312160.jpg

Yet-Zio commented 1 year ago

Hello @Wjxfi , yetCalc calculates percentages in a more traditional, mathematical way. To get the same result as open calc, use % operator with asterisk(). For example: 1000-90%1000

Yet-Zio commented 1 year ago

I will mention this issue in help so that more users can get an idea. By default percentage operator calculates in 1

Wjxfi commented 1 year ago

Where's the asterisk? I don't see it

Wjxfi commented 1 year ago

I don't think that's convenient. Writing half a math example all over again, and before I do, I need to find where that asterisk is

Can you make a percentage mode switch in the settings? That would be very helpful

Yet-Zio commented 1 year ago

Sorry @Wjxfi , by asterisk I meant the multiplication operator. Hope this helps. I have just updated the help as well.

Sorry about the asterisk part, that was a mistake

Yet-Zio commented 1 year ago

@Wjxfi sure I was thinking to add that but couldn't figure out how since the calculations are handled directly by mXparser. I will add it surely when I figure it out.

Wjxfi commented 1 year ago

@Yet-Zio your method doesn't work 312169.jpg 312167.jpg

Yet-Zio commented 1 year ago

@Wjxfi ofc its not gonna work for division. You are dividing 150/5% , which I don't know how open calc's implementation is, percentage really varies even in google, but its quite different. Whereas in yetcalc you are dividing 150/5%*150, that means 5% of 150 or 150/5%/150, that means 5% by 150. The question here is how is open calc handling it, it appears wrong to me. For division you can do basically: 150/5% which would work. No need for multiplication if that's your doubt. Hope it helps. Feel free to ask anything. I am having exams tmrw and about to sleep, that's why there was a delay in conversations.

Wjxfi commented 1 year ago

just look in the opencalc code https://github.com/Darkempire78/OpenCalc

Yet-Zio commented 1 year ago

@Wjxfi I have looked at the source code, particularly at Expression.kt , it does not explicitly state how it handles every operator. Also the result is wrong, percentages are not handled like that(mathematically). You can enter the same expression in any other calculator other than open calc, for example: 150/5% , it should give 3000. Percentages are calculated in 1 by default. So the expression: 150/5% will give you the result(you don't need to multiply), here yetCalc is correct.

Yet-Zio commented 1 year ago

Closing as this is hopefully solved

Wjxfi commented 1 year ago

you could have asked the developer how to do it.. okay

Yet-Zio commented 1 year ago

@Wjxfi, I was talking about how division operators are handled through percentages. Your screenshots provided had this expression: 150/5%/150. Now why would you divide a percentage or multiply it? You only do that for adding and subtracting.

It should be just 150/5% which is 3000. Please check with any other calculator as well. Result in openCalc is wrong.