Is your feature request related to a problem? Please describe.
The Calculator plugin can't calculate percentages. Typing 200+15% or 200*15% shows no result, because % is the modulo operator in Mages. Percentages are one of the most common everyday calculations (discounts, taxes, tips), so I keep having to open another calculator for them.
Describe the solution you'd like
Treat % as a percent sign when no number follows it, the same way a handheld calculator does:
| Input |
Result |
15% |
0.15 |
200*15% |
30 |
200/50% |
400 |
200+15% |
230 |
200-15% |
170 |
100-10%-10% |
81 |
Modulo keeps working when a number follows %: 10%3 is still 1.
Describe alternatives you've considered
Writing 200*1.15 by hand works, but it is slower and less natural than 200+15%.
Additional context
I already have a working implementation with unit tests and will open a PR for it. Related: #4078 asked for % as modulo, and that behavior is kept.
Is your feature request related to a problem? Please describe.
The Calculator plugin can't calculate percentages. Typing
200+15%or200*15%shows no result, because%is the modulo operator in Mages. Percentages are one of the most common everyday calculations (discounts, taxes, tips), so I keep having to open another calculator for them.Describe the solution you'd like
Treat
%as a percent sign when no number follows it, the same way a handheld calculator does:15%200*15%200/50%200+15%200-15%100-10%-10%Modulo keeps working when a number follows
%:10%3is still 1.Describe alternatives you've considered
Writing
200*1.15by hand works, but it is slower and less natural than200+15%.Additional context
I already have a working implementation with unit tests and will open a PR for it. Related: #4078 asked for
%as modulo, and that behavior is kept.