convert_to_si
Reduce any unit or compound expression to its SI base units (kg, m, s, etc.) to see the true dimensional makeup and magnitude.
Instructions
Reduce a value or unit expression to its SI base units (GNU units engine, TODO §17).
Rewrites any expression in terms of the database's primitive/base units — kg, m,
s, A, K, mol, cd, and the like — collapsing all derived and prefixed units. This
is how you see what a quantity really is dimensionally: kW*hour becomes
3600000 kg m^2 / s^2 (3.6 MJ), newton becomes 1 kg m / s^2. Use it to
compare or sanity-check units, or to get a magnitude in coherent SI.
Returns: expr (echoed), result (the reduced quantity WITH its base-unit
signature, e.g. "3600000 kg m^2 / s^2" — the primary human-readable answer),
value (the same magnitude as a bare float for programmatic use), dimension
(just the base-unit signature, e.g. "kg m^2 / s^2", or "1" when dimensionless),
and exact (true when the result is exact, false when it was rounded).
Errors cleanly (isError) when a unit is unknown, an expression is malformed, or
it is a nonlinear unit with no linear base form (e.g. tempF).
Example: convert_to_si("kWhour") ->
{"expr":"kWhour","result":"3600000 kg m^2 / s^2","value":3600000.0,
"dimension":"kg m^2 / s^2","exact":true}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | The quantity or unit expression to reduce to SI base units. May carry a numeric coefficient and be compound: 'kW*hour', '100 W', 'acre ft', '55 mile/hour'. A bare unit like 'newton' is treated as one of that unit. ⚠️ In the GNU units database single-letter names are literal: 'h' is Planck's constant, not hour — write 'hour' (so energy is 'kW*hour', not 'kW*h'). Nonlinear units (e.g. 'tempF') have no linear base form and error. |