If you get a value from the NBT storage with /data get storage ...and scale it (using the scale parameter), that same value is only casted and stored as an integer value.
This has the implication that operations with values between 0 and 1 are impossible and all operations have rounding errors because they are truncated incorrectly. Even if said value is written back to a double NBT storage, it is of no use, because /data get ... [scale] returns only INT values anyway. So it would be advantageous to:
a) Include a round() before the cast to Int to fix the rounding error.
b) If a /data get ... [scale] function is used, that its return type is changed to Double. [PREFERRED]
----------------------------------------------------------------------------------------------------
Example:
/data merge storage minecraft:villaton {test_1:48}Β -----> Store Value 48
/execute store result storage minecraft:villaton test_2 double 1 run data get storage minecraft:villaton test_1 0.1 -------> Divide Value 48 by 0.1 and save it. Returns 4 instead of 4.8 or 5.
/execute store result storage minecraft:villaton test_2 double 1 run data get storage minecraft:villaton test_1 0.01 ---------->Β Dividing the value by 0.01 returns 0 instead of 0.48. Theoreticly this is rounded correctly. But if it would be 98 divided by 0.01 it would still be 0. Also it is not possible to use ist as decimal at all, because it always is returned as INT by the scale operation.
--------------------------------------------------------------------------------------------------------
Β
Thank you for your report!
We're tracking this issue in MC-121824, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
π Bug Tracker Guidelines β π¬ Community Support β π§ Mojang Support
π Project Summary β βοΈ Feedback and Suggestions β π Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.