Skript
Skript copied to clipboard
Fix rounding accuracy
Description
- Removed unused methods
- Cleaned up file
- Adjust rounding methods with
Skript.EPSILON
before handling (lines 169, 184, 199, 206, 216, 226)
Target Minecraft Versions: any Requirements: none Related Issues: #4235
Well, whatever the fix, due to the limitations of floating-point numbers' representation, there will always be a "bug" somewhere.
function floor_test():
set {_a} to 3.9999999999
set {_b} to floor({_a})
broadcast {_a}.toString()
broadcast {_b}.toString()
While you could call that behaviour a bug, 3.9999999999 = 4
according to Skript (as seen in Javadoc of Skript.EPSILON), so this is to be expected. We have to draw the line somewhere, and Njol (probs) decided 10^-10
was the width of that line
Right, I guess it's still better than having inconsistencies occurring at 2 decimal places.