Skip to content

Unnecessary floating point digits being serialized in some (but not all) cases #107095

@eigensummer

Description

@eigensummer

Tested versions

  • Reproducible in: 4.5.dev5
  • Not reproducible in: 4.5.dev4

System information

Godot v4.5.dev5 - Arch Linux #1 ZEN SMP PREEMPT_DYNAMIC Thu, 29 May 2025 21:42:00 +0000 on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - integrated Intel(R) Iris(R) Xe Graphics (RPL-P) - 13th Gen Intel(R) Core(TM) i9-13900H (20 threads)

Issue description

The new floating point serialization from #98750 has caused a few cases where numbers get serialized with unnecessary digits, causing git noise. Specifically, with shader uniforms (both global and local) and @export variables. It doesn't seem to affect the Environment resource.

Steps to reproduce

  1. Create a float global uniform in the project settings
  2. Set the value to something else, e.g. 0.02 or 1.2

  1. Create a script
  2. Add a float property with @export_range(0, 2, 0.1) and a default value of 1
  3. Add a float property with @export and a default value of 1
  4. Use the slider to change both values to 1.2
  5. In the .tscn, the first one will be 1.2000000000000002, and the second will be 1.1999999999970896

  1. Add a WorldEnvironment
  2. Change a value (for example, the tonemap exposure) to 1.2
  3. Check the .tscn file and see that it has been serialized as 1.2 without any unnecessary digits

Minimal reproduction project (MRP)

float_noise_test.zip

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Bad

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions