microsoft / microsoft/calculator
associativity of the power (^) operator
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 31.1k
- Forks
- 5.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
The power (^) operator is by convention* right-associative. But the Calculator does not seem to follow that.
Steps To Reproduce
- Go to Scientific View
- Input 2 ^ 3 ^ 2, Hit "="
- The result is 64. ((2^3)^2=64)
Expected behavior
Should be 512. (2^(3^2)=512)
Screenshots
Device and Application Information
- OS Build: 10.0.19045.0
- Architecture: X64
- Application Version: 11.2210.0.0
- Region: zh-CN
- Dev Version Installed: False
Additional context
* See: https://en.wikipedia.org/wiki/Operator_associativity
and https://en.wikipedia.org/wiki/Exponentiation
Requested Assignment
I'm just reporting this problem. I don't want to fix it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the expression in Scientific View using 2 ^ 3 ^ 2, then trace the calculator's expression evaluation to find where operator associativity is determined. Done means the expression evaluates to 512 rather than 64, with coverage for this chained-power case if the existing evaluation tests are located.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100