-
Bug
-
Resolution: Unresolved
-
None
-
1.16.3, 20w51a, 1.19.2, 22w42a
-
None
-
Community Consensus
-
(Unassigned)
The bug
When a float/double NBT tag is converted to string NBT while containing the floating point values of NaN or infinity, the resulting value is NaNf / NaNd and Infinityf / Infinityd.
However, when parsing SNBT, those values are read not as floats/doubles, but as strings. Therefore, a round-trip conversion leads to information loss with these values.
How to reproduce
/data modify storage test:test test set value 999e999f /data get storage test:test test /data modify storage test:test test set value Infinityf /data get storage test:test test
The first command converts SNBT (999e999f) to an NBT float (infinity)
The second command converts the NBT float (infinity) back to SNBT (Infinityf)
The third command converts SNBT (Infinityf) to an NBT string ("Infinityf")
The fourth command converts the NBT string ("Infinityf") back to SNBT ("Infinityf")
Another way to test this would be using the server data generator NBT <-> SNBT converters to see the round-trip transformation from infinity/NaN floating point tags to string tags