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:
+3
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user