Mages icon indicating copy to clipboard operation
Mages copied to clipboard

Feature Request: Percentage modifier

Open TBM13 opened this issue 4 months ago • 2 comments

I'm not sure what to call it and it'd probably be a pain to implement it, but it'd be super useful if % could also be used as a "percentage modifier" (in addition to being the modulo operator).

For example: 100 + 40% -> 140 60 - 50% -> 30 60 * 50% -> 30 100 * 25% -> 25 100 - 25% -> 75

If there's a number after the % then it should behave as the modulo operator: 100 + 6 % 4 -> 102

It's probably a little confusing so I doubt you'll actually implement it, but wanted to give this a shot :)

TBM13 avatar Dec 15 '25 21:12 TBM13

Looks cool, but I don't see the pain in "4%" or "50%", but rather in the "20+10%", i.e., take the left hand side of an operator and use the value divided by 100 in it, such that "x + y%" = "x + y*x/100" or in multiplications do "x * y%" = "x * y/100".

I am not sure if I got all the cases (quite sure I did not), but this would be quite a pain... Let's keep it open, maybe I'll (or sb else) wants to tackle this one / comes up with a concept and idea for an implementation.

FlorianRappl avatar Dec 15 '25 23:12 FlorianRappl

Sounds good. Google's calculator on Android has this so it could be used as a reference

TBM13 avatar Dec 16 '25 01:12 TBM13