godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.1k stars 21.18k forks source link

Loss of float precision when using `save as` on a text resource or scene #99103

Open nikitalita opened 1 day ago

nikitalita commented 1 day ago

Tested versions

current master @ ec6a1c0e792ac8be44990749800a4654a293b9ee

System information

macOS 14.5.0, M2 Pro, Vulkan

Issue description

Re-saving a text scene/resource as another text scene/resource with float properties results in a loss of precision when the float has a precision of >6.

This is an issue with String::num_scientific;

The default for printf('%lg') is 6 precision.

Steps to reproduce

Open the MRP an editor Re-save main.tscn as main-2.tscn Observe that MobTimer.wait_time has reduced in precision from 0.570710678118 to 0.570711

Minimal reproduction project (MRP)

dodge_the_creeps.zip

clayjohn commented 1 day ago

This might be a duplicate of https://github.com/godotengine/godot/issues/78204 In either case, https://github.com/godotengine/godot/pull/98750 should fix this issue. Do you mind testing out https://github.com/godotengine/godot/pull/98750 and confirming?

nikitalita commented 1 day ago

yup, that fixes it.