sosauce / CuteCalc

CuteCalc is a simple,lightweight and open-source calculator app for Android.
GNU General Public License v3.0
98 stars 8 forks source link

Issue with Percentage Calculation #41

Closed kamrulhasanio closed 6 months ago

kamrulhasanio commented 7 months ago

Describe the bug I encountered an issue when performing percentage calculations in Cute Calc.

To Reproduce

  1. Open the Cute Calc app.
  2. Input the following calculation: 500 - 20%
  3. Observe the error or unexpected behavior.

Expected behavior I expected the app to correctly calculate the result of 500 minus 20%.

Screenshots https://github.com/sosauce/CuteCalc/assets/142052078/314a3c97-2b4b-40e5-88a5-00ca8e5f350f

Smartphone:

quadroli commented 7 months ago

Ah yess I remember being confused by this too, but that my friend is the modulo operator i.e. it gives you the remainder of an operation i.e. 10%3 = 1

See #15

sosauce commented 7 months ago

Yeah, the % is to calculate modulo, I should specifie it..

realeatham commented 7 months ago

Why not just switch it to percentage

sosauce commented 7 months ago

Because I'm using a math library (Keval). So I can't cuange what it does..

realeatham commented 7 months ago

Does keval have percentage at all?

sosauce commented 7 months ago

No, but % is used for remainders in math so I understand why not, maybe I could find a workaround since people don't seem to know about modulos..

realeatham commented 7 months ago

Can you give me a link to keval?

sosauce commented 7 months ago

https://github.com/notKamui/Keval

realeatham commented 6 months ago

You can definitely add percentage to that as it supports more operators and overriding preexisting operators.

realeatham commented 6 months ago

I might try later

quadroli commented 6 months ago

But that would mean coming up with a new symbol for it .. because mathematically both modulo and percentage are denoted by %

quadroli commented 6 months ago

And I'd argue modulo is more important because it's an operator .. but as for percentage, its just a different way to represent a no. i.e. 24% = 0.24 = 24/100

realeatham commented 6 months ago

You can just remove modulo, it's a scientific calc thing.

realeatham commented 6 months ago

Most people will want percentage

sosauce commented 6 months ago

Yeah, why have a button that is just a division. May just completely remove % button. Could use Keval{} to change the behavior but erh. Will test it but prolly will remove the % button

sosauce commented 6 months ago

Might replace with exponents ? I've found myself needing exponents way more then modulo/percentage espcially since the grade im in at school we use it very often. Let me know what y'all find more usefull

realeatham commented 6 months ago

Yeah, exponents are a lot more useful. I did have an idea for how to have both in one button which we could use, but it's hard to describe, I'll make an animation to show it later maybe. But exponents is definitely more useful than percentage and modulo is basically useless.

sosauce commented 6 months ago

I've changed it to exponent, now just have to figure out how to add a cursor to the text (I have no idea how 💀)

realeatham commented 6 months ago

Ok. Don't forget to change landscape mode aswell.