Feature Library

Units that carry through arithmetic, and goal seek

1.57 CPU ms
A still of the Units that carry through arithmetic, and goal seek demo
Still
The live demo starts when it’s in view.Edit any value or formula · focus a row to see what it reads and what cancels · ask the goal seek on the right, then Apply

Numbers that keep their units through every step.

What it costs a frame

1.57 ms
GPU
not used
CPU, median
1.57 ms
CPU, 95th pct
2.08 ms
Draw calls
0
Weight
Moderate

Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged CPU 1.52–1.61 ms). What ran: Measured with the sheet editing itself: every frame it types a new rate into “jars per hour” (40, 41, … 49), so each frame reads the entry, works the whole sheet out again (13 rows, units carried through every step) and repaints the results, the unit fractions and the explanation. Nothing runs while nothing is typed. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed1.572.08
apple · Apple A19 Proin a browser tab · 16 November 2026not timed4.424.86
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed2.733.59

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Calculators and estimators where people type “120 jars/h” or “€3.20/kg”
  2. Planning sheets: rates × time, cost per unit, totals per week
  3. Catching unit mistakes before they become wrong numbers
  4. Showing rates per hour, shift, working day or week
  5. Answering “what price would make this profit?” (goal seek)
  6. Formula fields in a no-code tool or a board app

Pitfalls, in brief

  1. A quantity is stored in base units (2 h is 7200, written “h”): read what people see with shown(q) or formatQty(q), never q.n.
  2. Any word that is not a known unit becomes a dimension of its own (“jars”, “bottles”): a typo such as “hors” is a new unit, not an error, and then fails to add to hours.
  3. Plurals are folded only by a trailing s (“jars” = “jar”, but not “boxes” = “box”, and “glass” stays “glass”).
  4. Each currency is its own dimension, so € + $ is refused rather than converted at a rate nobody set.
  5. In a formula, only known units follow a number (“30 min”, “1 shift”); a custom unit needs qty(30, "jars"), or the word is read as a row name.
7 more in brief
  1. Labels are kept as written: “hours” stays “hours”, “eur” stays “eur” (not “€”).
  2. The calendar (shift, wd, ww, mo, yr) lives in the unit table: change it, and make a new table; reuse one table for all the rows of a sheet so they agree.
  3. Goal seek works out the whole sheet once a try (up to 80): keep sheets small or the function cheap, and run it on a click, not on every keystroke.
  4. Messages quote what people typed.
  5. Typing always reads a point as the decimal mark (“1,500” is fifteen hundred), whatever the display writes: with a decimal comma shown (1 234,50), say so by the field, or turn the comma into a point before readQuantity.
  6. compare (and so min, max and the step check of round) counts two quantities as equal when they differ by less than 1e-9 in base units (a billionth of the value above 1): below a microgram, a nanometre or a nanosecond, values are not told apart.
  7. round, ceil and floor snap to 12 significant figures before rounding (so floor(€0.30, €0.10) is €0.30, not €0.20); a step finer than that relative to the value is not kept.
12 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

The secant method and bisection (bracketed root finding): Goal seek brackets the target, then narrows with secant steps, halving every third step and whenever a secant step would leave the bracket. Textbook numerical methods; the code is the owner’s.

unitsdimensionsquantitiesconversionratescurrencycustom unitsformulascalculatorspreadsheetgoal seeksecant methodwhat-ifplain-English errorspuretestedno dependencies

Near it in the frame