Replies: 3 comments
-
The system calculator on iOS specifically handles the addition or subtraction of percentages at the beginning of an expression in this special way. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Moving this into a discussion |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm ok with thinking though improving the behavior of percentage, I'm open to a PR that implements an improvement. It can be that the new behavior is a trade-off, we really have to see how it works out. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
I understand the special operation rules of percent signs. However, for consecutive addition or subtraction percent operations at the beginning of a recursive expression, according to the tendency of regular users, should this be treated as a special case?
For example, when encountering expressions like
a% + b% + c% +...
at the start of a calculation, currently, it seems to be interpreted asa% * (1 + b%) * (1 + c%)
, rather than(a+b+c)%
. This can lead to unexpected results.To Reproduce
Take the expression
10% + 10% + 100 + (10% + 10% + 100) + 10% + 10%
. Currently, mathjs interprets it as(0.11 + 100 + (0.11 + 100)) * 1.1 * 1.1
, which is different from the expected value of(0.2 + 100 + (0.2 + 100)) * 1.1 * 1.1
.I think this might be a special case in percentage shorthand operation logic and could be considered for a future update. Has this been considered? If so, are there any plans to address this behavior?
Beta Was this translation helpful? Give feedback.
All reactions