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
+3 -2
View File
@@ -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: