From 07dbb6261e84378cf459a5f3bde5e0ae093e8ccd Mon Sep 17 00:00:00 2001 From: mikael-lovqvists-claude-agent Date: Sun, 22 Mar 2026 15:05:10 +0000 Subject: [PATCH] future-plans: store measurement as {value, prefix, unit}, canonical only for queries Co-Authored-By: Claude Sonnet 4.6 --- future-plans.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/future-plans.md b/future-plans.md index 6d84e02..adbe79f 100644 --- a/future-plans.md +++ b/future-plans.md @@ -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