Mojira Archive
MC-212345

Scaling during execute store command causes loss of precision when given precision number

When using the "scale" parameter in the "execute store" command, the final output is equivalent to if the input was treated as an integer, even when the attached command returns a single- or double-precision number. Why should this be the case?

 

How to recreate:

Store a dummy NBT value in storage as a double.

data merge storage dummy {test:4.2d}

Grab the NBT value in storage and store it after scaling the value using the execute store command

execute store result storage dummy test2 double 2.5 run data get storage dummy test

Grab this new test2 value from storage

data get storage dummy test2

In my example, instead of the game returning "10.5d", it returns "10.0d" which is accomplished if you take the product of 4.0 and 2.5. The game treated test1 as an int even though the value returned from the "data get" command is a double. If the "data" command returns a double and the scaling factor is a double, why should the nbt value be changed to an int? It seems like an unnecessary way to lose precision in your calculations.

Duplicate

NoRamen

2021-01-21, 08:35 PM

2021-01-22, 07:09 AM

2021-01-22, 07:04 AM

0

0

Unconfirmed

(Unassigned)

21w03a, 1.16.5

-