Files
calctext/_bmad-output/implementation-artifacts/2-2-si-prefix-support.md
2026-03-16 19:54:53 -04:00

47 lines
1.7 KiB
Markdown

---
epic: 2
story: 2.2
title: "SI Prefix Support"
status: draft
---
## Epic 2 — Unit Conversion System
**Goal:** Support 200+ units across all major categories with SI prefix support.
### Story 2.2: SI Prefix Support
As a CalcPad user,
I want SI prefixes (nano through tera) recognized on any applicable unit in both short and long form,
So that I can naturally write expressions like `5 km` or `200 MB` without needing separate unit entries for every prefixed variant.
**Acceptance Criteria:**
**Given** the expression `5 km in miles`
**When** the engine evaluates it
**Then** it recognizes `km` as `kilo` + `meter`
**And** the result is approximately `3.10686 miles`
**Given** the expression `200 MB in GB`
**When** the engine evaluates it
**Then** it recognizes `MB` as `mega` + `byte` and `GB` as `giga` + `byte`
**And** the result is `0.2 GB`
**Given** the expression `3 µs in ms`
**When** the engine evaluates it
**Then** it recognizes `µs` as `micro` + `second` and `ms` as `milli` + `second`
**And** the result is `0.003 ms`
**Given** the expression `5 kilometers in miles`
**When** the engine evaluates it
**Then** it recognizes the long-form prefix `kilo` combined with `meters`
**And** the result matches the short-form `5 km in miles`
**Given** SI prefixes from nano (10^-9) through tera (10^12)
**When** each prefix is applied to a compatible base unit
**Then** the conversion factor is correctly applied: nano=10^-9, micro=10^-6, milli=10^-3, centi=10^-2, kilo=10^3, mega=10^6, giga=10^9, tera=10^12
**Given** an SI prefix applied to a unit where it does not make sense (e.g., `kilofahrenheit`)
**When** the engine encounters it
**Then** it does not recognize the combination as a valid unit
**And** it returns an appropriate error or treats the input as text