From ef80bf9a373a955bdec332256af9762643319d46 Mon Sep 17 00:00:00 2001 From: Arda Aydin Date: Sat, 12 Sep 2026 14:03:04 +0300 Subject: [PATCH] Format live float values to 6 significant digits matching 32-bit precision Sox reads 32-bit floats that Python promotes to 64-bit doubles, producing display artifacts like 22.011558532714844. Using :.6g format gives clean values matching .sax file precision (22.0116, -19.9574, 175, 14). Applied to both initial DOM build and COV update paths. Co-Authored-By: Claude Opus 4.6 --- app_state.py | 2 +- device_session.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app_state.py b/app_state.py index f317a74..641ac94 100644 --- a/app_state.py +++ b/app_state.py @@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it. import configparser import os -VERSION = "0.0.0.087" +VERSION = "0.0.0.088" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/device_session.py b/device_session.py index ff218dc..d9141ec 100644 --- a/device_session.py +++ b/device_session.py @@ -268,7 +268,7 @@ class DeviceSession: if name in sox_comp.values: val = sox_comp.values[name] if isinstance(val, float): - val_str = f"{val:.4f}".rstrip("0").rstrip(".") + val_str = f"{val:.6g}" else: val_str = str(val) ET.SubElement(comp_elem, "prop", @@ -365,7 +365,8 @@ class DeviceSession: continue name = slot["name"] if name in sox_comp.values: - val = str(sox_comp.values[name]) + raw = sox_comp.values[name] + val = f"{raw:.6g}" if isinstance(raw, float) else str(raw) if name in existing_props: existing_props[name].set("val", val) else: