-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
x% of y expression #2692
Comments
I'm not too sure what you mean here, 1% is 0.01, and Skript is not wrong in that respect. |
Yes but 1% of 100 is 1. Skript hasn't always translated 1% into decimals like it is now. It's rather confusing and honestly pretty useless. To clarify a little more |
@ThePumpkin5822 Not sure how you think percentages are calculated, but you surely don't do it by removing 1% from the value. Skript is right here. To get 99 from this, do |
That is utterly useless and confusing for new users. I can do the exact same thing with 0.01. |
@ThePumpkin5822 Please refer to this image |
You're saying math is useless? Brilliant. @bensku What are your thoughts on this? |
Where did you get that? Also, according to calculators (but, as far as I can see, no official documentation), this issue is valid, and 100-1% is 99, not 99.99. Skript would probably need to implement special handling for this — this seems counter-intuitive (Percentages can be treated as division, division before subtraction, lots of stuff is broken). |
You are enforcing your point with the image that 1% is 0.01 regardless of the fact the value should be of the original number. Since adding percentages as their are now would be useless because it's not only invalid, there's already a way to do that within Skript. |
I have no idea when Skript's behavior changed, but Skript is correct that 1% is 0.01. What you want instead is an expression that provides the value for |
@Wealthyturtle After looking at it, this does look weird to me, as a standard calculator would get 99 from this, not 99.99 (Source: Samsung A6 built-in calculator, WolframAlpha, Google) |
¯_(ツ)_/¯ |
I feel like 1% is not equal to any number, if no context is given. A percentage is a number to describe a part of a whole, and is therefore not equal to any number. If you use it in a calculation, such as |
I suggest not changing this behavior |
Rule of thumb: if you use sufficient parenthesis, Skript will eventually do what you want it to |
Description
Having skript remove a percentage of a number results in skript removing the decimal version instead of the percentage of the original number.
Steps to Reproduce
Expected Behavior
For example
set {_math} to 100-1%
results in 99.99 because it translates 1% to 0.01 instead of 1% of 100 before removing the amount.Errors / Screenshots
https://imgur.com/a/zWXNJOM
Server Information
Minecraft: 1.14.4
Paper: 234
Spigot: git-Spigot-56f8471-3e3818b (MC: 1.14.4)
Skript: 2.4 Stable
Additional Notes
I don't think this is intended, so I'm sorry if it is. This is quite confusing, and I didn't see another way to take a percentage value of a number within Skript (for example
set {_math} to 1% of 100
).The text was updated successfully, but these errors were encountered: