future-plans: store measurement as {value, prefix, unit}, canonical only for queries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 15:05:10 +00:00
parent a17bafb6d3
commit 07dbb6261e

View File

@@ -133,16 +133,19 @@ defines the set of valid units and the conversion factors between them (°C, °K
°F for temperature; Ω, kΩ, MΩ for resistance; etc.).
SI prefixes (k, M, µ, n, p, etc.) are not separate units — they are a presentation
layer on top of a unit. `25kΩ` should be parsed as value `25000`, prefix `k`, unit
`Ω`, and stored as `{ value: 25000, unit: "Ω" }` (or in a canonical base unit).
The prefix is re-applied on display based on the magnitude. This keeps comparisons
and conversions clean without treating kΩ and MΩ as distinct unit types.
layer on top of a unit. `25kΩ` should be stored as
`{ value: "25", prefix: "k", unit: "Ω" }` — preserving the original string value
and prefix exactly as entered, so no precision or notation is lost.
A canonical numeric form is derived from the stored triple only when needed for
comparison or search queries (e.g. `R < 10k` → compare canonical floats). Display
always reconstructs from the stored `value + prefix + unit`, so `4k7` stays `4k7`
and `25.0` stays `25.0`.
This would allow:
- Entering values in any compatible unit and SI prefix, storing canonically
- Displaying in the user's preferred unit and auto-selecting an appropriate prefix
- Parametric search with cross-unit and cross-prefix comparisons (e.g. `R < 10k`
matching both `4k7Ω` and `0.001MΩ`)
- Lossless storage of entered values (significant digits, notation style preserved)
- Parametric search with cross-prefix comparisons via derived canonical values
- Unit conversion on query (e.g. `temp > 200K` matching a stored `-73°C`)
- Catching unit mismatches at entry time
## PDF / files