When a Correct Unit Conversion Answers the Wrong Question
A unit conversion can return a plausible number while answering the wrong question. The arithmetic is often the easy part; the hard part is preserving what the number means.
I maintain ToolKnit, including its browser unit converter. This guide uses that tool as a concrete example, including a limitation in its data-unit labels. The examples below are illustrative, and the three UI checks are identified separately from the design recommendations.
1. Store the quantity, not just the number
An input named “size” is underspecified. It could mean width, diameter, area, volume, or bytes. Even “12 inches” does not tell you whether a product listing describes usable internal space or the outside of its packaging.
For a measurement field, keep at least:
- The numeric value.
- The unit, spelled out or unambiguously identified.
- The quantity being measured, such as external width.
- Any convention required to interpret it, such as decimal versus binary storage units.
A UI can show a short label, but the stored record and exported report should preserve that context. Otherwise the next person has to guess.
2. Distinguish a temperature from a temperature difference
For a temperature reading, use:
F = C × 9/5 + 32
For a difference between two readings, the constant cancels:
ΔF = ΔC × 9/5
That distinction changes the answer. A reading of 10 °C is 50 °F. A rise of 10 °C is a rise of 18 °F. Pasting a temperature difference into an ordinary temperature converter produces a valid conversion of a different quantity.
On November 15, 2026, I checked the live converter with 0 °C and 10 °C. It displayed 32 °F and 50 °F respectively. These are checks of temperature readings; they do not establish support for a temperature-difference mode.
For a sensor dashboard, label a change as “temperature rise” or “temperature difference,” and keep its calculation separate from absolute readings. Do not use the same conversion function for both just because the unit symbols look similar.
3. A storage prefix needs a declared basis
Decimal storage units use powers of 1,000. Binary storage units use powers of 1,024 and distinct names:
| Unit | Bytes |
|---|---|
| 1 MB | 1,000,000 |
| 1 MiB | 1,048,576 |
| 1 GB | 1,000,000,000 |
| 1 GiB | 1,073,741,824 |
ToolKnit's current page explicitly says that its Data category uses 1,024-based factors while retaining legacy KB/MB/GB labels. Read a displayed “1 GB = 1024 MB” there as a binary calculation corresponding to GiB and MiB. Do not use that display as evidence that SI decimal GB and MB have a 1,024 ratio.
For a file-size limit in an application, store the limit in bytes and document the rule. If the requirement is decimal 200 KB, encode 200,000 bytes. If it is 200 KiB, encode 204,800 bytes. The label should agree with the comparison the program actually performs.
Also distinguish bits from bytes. Network rates commonly use bits per second; file sizes commonly use bytes. A theoretical rate conversion does not predict real download time without accounting for overhead and actual throughput.
4. Do not cross dimensions without another input
Millilitres measure volume; grams measure mass. Converting between them requires density. A tool that offers both a weight category and a volume category has not necessarily implemented a density-aware conversion.
For a recipe application, selecting the ingredient matters. Treating every ingredient as water can yield a neatly formatted but incorrect result. If density is unavailable, ask for it or state that the conversion is unsupported. A blank result with an explanation is more useful than an unexplained assumption.
For length, the conversion is simpler: one international inch equals 2.54 centimetres. The live ToolKnit page returned 20.32 cm when I entered 8 inches. That still says nothing about whether an “8-inch” pan refers to the inside rim, the outside rim, or a nominal product size. Measurement context must survive the conversion.
5. Test against independent anchors
A round-trip test is helpful but incomplete. If a forward function multiplies by the wrong factor and the reverse function divides by that same factor, converting out and back will recover the starting value. Both functions can still be wrong.
Use independent known values alongside round trips:
| Case | Expected result | What it checks |
|---|---|---|
| 1 inch → cm | 2.54 cm | Length factor |
| 0 °C → °F | 32 °F | Temperature offset |
| 10 °C → °F | 50 °F | Temperature scale and offset |
| 10 °C rise → °F rise | 18 °F rise | Quantity distinction |
| 1 MiB → bytes | 1,048,576 | Binary basis |
These are suggested test cases, not a claim that every mode in ToolKnit has been tested or that the tool implements temperature differences. Validate input domains separately: an empty field is not the same as zero, and non-finite values should not silently turn into ordinary measurements.
6. Keep display precision separate from measurement precision
Showing more digits does not improve the precision of a tape measure. Preserve enough internal precision to avoid repeated rounding, then choose the displayed precision based on the task. Keep the source value so edits do not repeatedly convert an already rounded result.
A useful review question is: Could another person reconstruct the original quantity and convention from this exported value? If not, add the missing unit, basis, or measurement label before sharing it.
The converter calculates entered measurements locally in the browser; loading the website and its resources is separate network activity. This article was prepared with AI assistance and checked against the visible interface. The three UI examples above are limited checks, not an accuracy audit of every tool mode.
Comments
Join the discussionNo comments yet. Be the first to comment.