Order of operations in integer arithmetic is wrong
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 540
- PR merge metrics
- No merged PRs in 30d
Description
**Reproduce**
{ 10 * 8 / 10 }
**Expected Output**
8
**Observed Output**
0
**Workaround**
{ (10 * 8) / 10 }
I'd expect the order of operations to go left to right, as is generally the case with other environments/programming languages. Unfortunately, fixing this might break existing Ink scripts that rely on this behavior. Also unfortunately, there's probably a lot of scripts out in the while that have bugs in them because of this bug.
**Addendum**
Looking at the following examples, it seems that the problem is that division has a higher priority than multiplication, which it shouldn't:
* Forcing right-to-left evaluation: { 10 / (2 * 2) } -> 2
* Forcing left-to-right evaluation: { (10 / 2) * 2 } -> 10
* Without brackets: { 10 / 2 * 2 } -> 10
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.