dataforth(datasheet): Fix 2 — emulate QB single-precision rounding (26 -> 9 dirty)
formatMeasuredExact now applies Math.fround to the parsed value before toFixed. The DOS QuickBASIC computed/stored these as single-precision floats, so the last-digit rounding at the .5 boundary follows single, not double, precision. Without it, double-precision toFixed flipped boundaries (9.9995 -> "9.999" vs golden "10.000"; 46.85 -> "46.9" vs "46.8"; .45 -> "0.5" vs "0.4"; 3.3325 -> "3.333" vs "3.332"). Verified each against the staged golden. STAGE 3 re-validation: FINAL-TEST CLEAN models 68 -> 85 (+17), mismatches 26 -> 9, cert matches 2123 -> 2206. Zero regression — every remaining dirty model was already dirty pre-fix; no previously-clean model flipped. The 9 remaining are NOT rounding: - 4 models (DSCA38-05/-1793/-19C/-19E): Supply Current retest data-vintage — the staged .TXT is an older test run than the DB latest-wins record; not a render bug, can't reconcile against an older sheet. - 5 models (DSCA39-01/02/05/07/1950): STAGE 1 template artifact — the footer note "Standard output load for test is 250 ohms." was mis-captured as a truncated parameter row. A renderer-side fix was attempted but emitted the note for all current-output models (regressed 24 clean -C models), so it was reverted; needs a targeted STAGE 1 extractor fix instead. Renamed dsca-clean68-models.json -> dsca-clean-models.json (now 85 models). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -327,8 +327,14 @@ function formatMeasuredExact(statusStr) {
|
||||
// char at index 4 is either a space (positive) or '-' (negative); start there
|
||||
// so negative signs survive (e.g. "PASS-4.2424060" -> "-4", not "4").
|
||||
const valueStr = statusStr.substring(4, statusStr.length - 1).trim();
|
||||
const value = parseFloat(valueStr);
|
||||
if (isNaN(value)) return { passFail, valStr: valueStr, value: NaN };
|
||||
const parsed = parseFloat(valueStr);
|
||||
if (isNaN(parsed)) return { passFail, valStr: valueStr, value: NaN };
|
||||
// The DOS QuickBASIC stored/computed these as single-precision floats, so the
|
||||
// value at the half-rounding boundary rounds the way single precision rounds,
|
||||
// not double. Recover the single (Math.fround) before formatting — without it,
|
||||
// double-precision toFixed flips last-digit boundaries (e.g. 9.9995 -> "9.999"
|
||||
// here but "10.000" in the original; 46.85 -> "46.9" vs "46.8").
|
||||
const value = Math.fround(parsed);
|
||||
const d = parseInt(decimalDigit, 10);
|
||||
const valStr = isNaN(d) ? value.toFixed(1) : value.toFixed(d);
|
||||
return { passFail, valStr, value };
|
||||
|
||||
Reference in New Issue
Block a user