fix: a readout keeps its metric prefix when the stream declares no unit
The SI prefix ladder in format_measure() was gated on a non-empty unit, so two decimals of a small unitless value printed `0.00` -- the reading gone, not merely coarse. That is a whole class of channels rather than a corner: a CONFIG need not declare a unit, and a math channel never has one. Below 1e-12 the same loss happened even with a unit, so that range falls back to three significant digits. With no unit the prefix goes tight against the number (`585.24m`), since the space exists to separate the number from its unit and a spaced `m` alone reads as metres. The mock declared `unit="V"` for every data signal, which is why no probe could see this; it now takes `--unit ''`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3d7e214295
commit
b505706d92
6 files changed
+66
-25
No files matched your search
@@ -1185,7 +1185,16 @@ Every readout is a **measurement**, not a raw number: at most two decimals, scal
|
||||
SI prefix so the digits sit in `1..999`, and the unit the stream declared appended —
|
||||
`10.52 mV`, `-9.8 V`, `dT -398.67 ms`, `1.06 pV`. Two decimals is the resolution the
|
||||
instruments can claim (a marker lands on a sample, and the sample is an `f32`), and a
|
||||
trailing zero is dropped, so `1.50 V` reads `1.5 V`. A row's rulers use its signals' unit
|
||||
trailing zero is dropped, so `1.50 V` reads `1.5 V`. The prefix is applied **whether or not
|
||||
the stream declared a unit**, and that is not a detail: a signal whose CONFIG declares none is
|
||||
ordinary, a *math* channel never has one, and two decimals of an unprefixed small value is
|
||||
`0.00` — the reading was simply gone for an entire class of channels, which went unnoticed
|
||||
because the mock declares `V` for everything (it now takes `--unit ''`, which is the only way
|
||||
a probe can see this). With no unit the prefix is written *tight* against the number —
|
||||
`585.24m`, not `585.24 m` — because the space is there to separate the number from its unit,
|
||||
and a spaced `m` with nothing after it reads as metres. Below `1e-12`, where no prefix can
|
||||
help, the value falls back to three significant digits in whatever form fits rather than to
|
||||
`0.00`. A row's rulers use its signals' unit
|
||||
when they agree on one and print bare digits when they do not: a ruler is on the row's y
|
||||
axis, and two units on one axis make "the" unit a guess. A trace's line carries the
|
||||
signal's **colour chip and its name** — `● sine 616.49 mV -24.57 mV -641.06 mV` — and the
|
||||
|
||||
Reference in new issue
Block a user