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 <noreply@anthropic.com>
This commit is contained in:
2026-09-12 14:03:04 +03:00
co-authored by Claude Opus 4.6
parent e33a6bc5d8
commit ef80bf9a37
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
import configparser import configparser
import os 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") PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
DEFAULT_GRID_SIZE = 10 DEFAULT_GRID_SIZE = 10
DEFAULT_ADD_TIMESTAMP = True DEFAULT_ADD_TIMESTAMP = True
+3 -2
View File
@@ -268,7 +268,7 @@ class DeviceSession:
if name in sox_comp.values: if name in sox_comp.values:
val = sox_comp.values[name] val = sox_comp.values[name]
if isinstance(val, float): if isinstance(val, float):
val_str = f"{val:.4f}".rstrip("0").rstrip(".") val_str = f"{val:.6g}"
else: else:
val_str = str(val) val_str = str(val)
ET.SubElement(comp_elem, "prop", ET.SubElement(comp_elem, "prop",
@@ -365,7 +365,8 @@ class DeviceSession:
continue continue
name = slot["name"] name = slot["name"]
if name in sox_comp.values: 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: if name in existing_props:
existing_props[name].set("val", val) existing_props[name].set("val", val)
else: else: