Prefix and Exponent Handling That's Easy to Miss

Editorial illustration in zellij-islamic-geometric style depicting a zellij UCUM prefix ladder with case-sensitive markers and longest-match rule

Prefix and exponent handling in UCUM look trivial and are the source of a real slice of subtle conversion errors. k for kilo. m for milli. 10*3 for a thousand. Every one of these has an easy failure mode: the wrong prefix compounds into a factor-of-thousand error, the wrong exponent flips a value from clinically normal to clinically extreme. The site's Clinical UCUM unit converter handles them; the pitfalls are worth knowing regardless. For the wider FHIR framing, the healthcare interoperability hub has more.

The Standard Prefix Set

  • Y yotta 10^24
  • Z zetta 10^21
  • E exa 10^18
  • P peta 10^15
  • T tera 10^12
  • G giga 10^9
  • M mega 10^6
  • k kilo 10^3
  • h hecto 10^2
  • da deka 10^1
  • d deci 10^-1
  • c centi 10^-2
  • m milli 10^-3
  • u micro 10^-6
  • n nano 10^-9
  • p pico 10^-12
  • f femto 10^-15
  • a atto 10^-18
  • z zepto 10^-21
  • y yocto 10^-24

Clinical work rarely leaves the range from p to k. But every prefix is legal, and a stray M where m was intended produces a millionfold error.

Case Sensitivity Matters

m is milli. M is mega. k is kilo. K is kelvin (a base unit, not a prefix).

Case-insensitive matching is a bug. UCUM parsers that lowercase input silently produce wrong prefixes.

For the base pattern, UCUM basics for developers who thought units were simple covers the ground.

Longest-Prefix Match

mm is millimeter, not mega·meter. UCUM parsers should match the longest prefix first, then fall back to shorter ones.

That is a subtle rule. Parsers that match greedily left-to-right without checking the composition can produce the wrong result on ambiguous codes.

Exponents

  • m2 — square meter
  • m3 — cubic meter
  • s-1 — per second (frequency)
  • 10*3/uL — thousand cells per microliter

Exponents are unsigned integers unless a hyphen prefixes them. The 10* shape is a UCUM convention for scientific notation without a base unit — used for cell counts, particle counts, and titers.

For the canonical set of units that use exponents, canonical UCUM units the FHIR spec assumes you'll use is the entry.

The Silent Off-By-Prefix

An observation storing mg where the source sent ug — a 1000× error. An observation storing mmol where the source sent umol — a 1000× error. A converter that does not verify prefix mapping between source and target produces these silently.

Every converter should log or expose the prefix mapping it applied. For the testing side, testing UCUM conversion against clinical fixtures covers the pattern.

Compound Units With Prefixes

mmol/L — milli-mole per liter. The prefix binds to the base unit before division. mol/mL — mole per milliliter (prefix binds to L, not mol).

Position matters. m prefixes the base unit it immediately precedes, not the whole expression.

Test With Boundary Values

Prefix errors are easiest to catch at boundary values — 0.001, 1000, 10^6. Test converters at those points; they surface off-by-prefix bugs that a mid-range value would mask.

The Short Version

Case-sensitive. Longest prefix wins. Exponents are unsigned unless hyphenated. 10*N is scientific notation. Prefix position matters in compound units. Test at boundary values. For the base pattern, UCUM basics for developers who thought units were simple is the entry.

Zellij-geometric diagram of UCUM prefix ladder with case-sensitive markers and longest-match rule annotated, arranged as tessellated tiles with indigo and violet accents on ivory

Sources

Aaliyah Jenkins

Interoperability specialist in Indianapolis. Covers MLLP, HL7v2 transport, and the parts of healthcare integration that haven't changed in 20 years.