Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skript doesn't follow order of operations with multiple divisors #2886

Closed
bluelhf opened this issue Mar 26, 2020 · 2 comments
Closed

Skript doesn't follow order of operations with multiple divisors #2886

bluelhf opened this issue Mar 26, 2020 · 2 comments

Comments

@bluelhf
Copy link
Contributor

bluelhf commented Mar 26, 2020

Description

The arithmetic expression a / b / c is treated as a / (b / c) instead of (a / b) / c

Steps to Reproduce

Run the following script:

on script load:
  broadcast "Expected 10 / 5 / 7 (%(10 / 5) / 7%), got 10 / (5 / 7) (%10 / 5 / 7%)"

Output is Expected 10 / 5 / 7 (0.29), got 10 / (5 / 7) (14).
Grab a calculator and calculate 10 / 5 / 7. The result is 0.285714285714... which rounds to 0.29
Observe the incorrect result of Skript's normal arithmetic.

Expected Behavior

The equation should be done correctly, according to the order of operations, and for 10 / 5 / 7, 0.29 should be returned (provided the number accuracy is 2 in config.sk)

Server Information

  • Server version/platform: Paper 1.15.2 (build 143)
  • Skript version: Skript 2.5-alpha2
@bluelhf bluelhf changed the title Skript doesn't follow order of operations with multiple dividors Skript doesn't follow order of operations with multiple divisors Mar 26, 2020
@bluelhf
Copy link
Contributor Author

bluelhf commented Mar 26, 2020

Closed as duplicate of #535
Bumping that instead, it's medium priority and has no fix yet?

@bluelhf bluelhf closed this as completed Mar 26, 2020
@Wealthyturtle
Copy link
Member

@bluelhf keep in mind that using a 3rd party Math library is not necessarily “easier” as Skript is first and foremost still a scripting language. It would be complicated to rewrite the entire parser for integration with a 3rd party Math parser. What would happen to expressions or functions used in conjunction to arithmetic operations for example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants