mojira.dev
MC-124223

'/data get' can return imprecise values

The bug

Running /data get can return imprecise values depending on the value type.

How to reproduce

  1. /summon armor_stand ~ ~ ~ {Pose:{Head:[0.01f,0.01f,0.01f]}}

  2. /data get entity @e[type=armor_stand,sort=nearest,limit=1] Pose.Head[0] 10000
    → Result is 99

  3. /data get entity @e[type=armor_stand,sort=nearest,limit=1]
    → NBT says [0.01f,0.01f,0.01f]. /data get is incorrectly rounding 0.01f to 0.009999

Comments 1

WAI; this is floating-point. If you want to perform a 'round upwards', you can do it yourself; one way is by changing 10000 to 20000, adding 1, and dividing by 2 the result.

onnowhere

Nathan Adams

Confirmed

/data-get

Minecraft 18w02a

Retrieved