Skip to main content
TrueMath attaches units to values and converts between compatible units automatically. This page catalogs the supported units by dimension and explains how compound units and conversions behave. For how units are written inside activity equations, see Writing equations; for how unit numbers behave as a data type, see Unit numbers.

Simple units

Area and volume units also accept the typographic forms and . Time units can also be squared (s^2, hr^2, …); squared time is the time² denominator that appears in acceleration units such as m/s^2. Most units also accept their full names, singular or plural, including common spelling variants — ft can be written foot or feet, and m as meter, meters, metre, or metres. Unit suffixes are case-sensitive: USD is not usd, and Gbit is not gbit or GBIT. Use the exact casing shown above.

Time units and dates

Time is the one dimension that does double duty: a duration and a date are both time values. A date is the count of seconds from the Unix epoch, which is why closing_date + 30 d works with no date-specific arithmetic at all — it is the same unit addition as 5 hr + 30 min. See Dates. The fixed-length time units are exact. A wk is always seven days and a d always 24 hours, so converting among ms, s, min, hr, d, and wk loses nothing.
mo and yr are average durations, not calendar steps. One mo is exactly 30.4375 days and one yr is exactly 365.25 days — the average length of a Gregorian month and year, leap days included.They are averages so that time conversions stay exact and reversible in both directions: 1 yr is precisely 12 mo, and 1200 USD/yr is precisely 100 USD/mo. What they are not is calendar operators. Stepping a date by an average lands wherever that many seconds falls: date(2026; 1; 31) + 1 mo is March 2 at 10:30, skipping February, and date(2026; 7; 21) + 1 yr is the right day of 2027 at 06:00 rather than midnight — a result that looks correct and compares unequal, with no error raised.For calendar-correct month and year math, use adjdate. To land on the first day of a month or year, use floor or ceil. See mo and yr shift by an average for the full picture.

Compound units

A compound unit combines a unit from one dimension with a unit from another. Any simple unit from each constituent dimension can be paired, so velocity covers m/s, km/hr, ft/min, and every other length-over-time combination, not only the named shorthands. TrueMath also recognizes a few shorthand suffixes for common pairings. Cost and per-unit-count compounds are written directly from their constituent units, for example USD/hr, USD/ft^2, or ct/m^2. A compound unit cancels the way the algebra does. Multiply a rate by the quantity it is per, and the shared dimension drops out, leaving the unit you were pricing in:
The last line is the same rule read backwards: dividing a currency by a time derives a rate. This is what makes a rate safe to carry in a domain — an hourly rate multiplied by a count of hours can only produce a currency, and multiplying it by an area instead is rejected rather than quietly wrong.

Conversion behavior

  • Compatible units convert automatically. 1m + 10cm produces a length; you never convert by hand.
  • The result takes the first unit in the expression. 5in + 10ft is 125in, and 5hr + 6min is 5.1hr — the leading unit sets the result and the rest convert into it.
  • Multiplication and division derive dimensions. A length over a time is a velocity; a currency over an area is a cost-per-area.
  • Incompatible units are rejected. 5m + 3kg is an error rather than a wrong number. See Combining types.

Values written in more than one unit

A quantity can be written across two or more units of the same dimension, the way it would be spoken:
The parts are added, so the result keeps the first unit written, exactly as any other sum does. What comes back is a single value in a single unit, and it stays that way through the calculation and on display — there is no feet-and-inches pair to carry around. 3ft 4in is 3.3333 ft.

Casting to a specific unit

To choose the unit a result is reported in, append a target unit to a parenthesized expression:
This returns the sum expressed in millimetres. Casting changes only the reported unit, not the underlying value, and the target must be compatible with the result’s dimension.
Angles are interpreted by the unit you attach: sin(45deg) and sin((pi/4)rad) are equivalent. See Trigonometry.