godotengine / godotengine/godot
Power operator's sequence should be performed right-to-left rather than left-to-right?
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
a586e860e5fc382dec4ad9a0bec72f7c6684f020
### System information
Windows 11
### Issue description
The power operator seems to be executed in not the common order of that operation. In the Python the order of this operation follows right-to-left: 1 ** (2 ** 3) while in Godot currently it's executed left-to-right like (1 ** 2) ** 3. The fix should be performed both in GDScript and the expression parser.
### Steps to reproduce
Executing the following code line will emit error
```
assert(2 ** 2 ** 3 == 256)
```
In Python that code will be evaluated to true, while in Godot the result is 64, which is incorrect.
### Minimal reproduction project (MRP)
Too easy to reproduce
Contributor guide
Assessment
This issue has not been assessed yet.