Reference · Units

Units

12 words. Sorted alphabetically.

->SI
  • ( q:quantity -- q:quantity )

Normalize quantity display unit to SI base form.

COMPAT-UNITS
  • ( q:quantity -- ...:string n:integer )

Symbols whose dimension matches a quantity's, bottom-to-TOS, then count. Excludes the quantity's own current unit.

CONVERT
  • ( q:quantity s:string -- q':quantity )

Convert quantity to a named unit. 1_m "ft" CONVERT -> 3.2808_ft. Error on dim mismatch.

DIM
  • ( q:quantity -- e0:integer e1:integer e2:integer e3:integer e4:integer e5:integer e6:integer e7:integer n:integer )

Decompose: push 8 dim exponents (bottom-to-TOS) then 8. Use ->ARRAY to collect.

DIM-COMPAT?
  • ( a:quantity b:quantity -- bool:boolean )

Are these two quantities dimensionally compatible?

SI-VALUE
  • ( q:quantity -- d:number )

SI-normalized value (strip unit).

SIMPLIFY
  • ( q:quantity -- q:quantity )

Recognize quantity dimensions as a registered derived unit (N, J, W, ...).

UNIT-DEF
  • ( sym:string dim:array scale:number offset:number )

Register a new unit. "smoot" 1 0 0 0 0 0 0 0 8 ->ARRAY 1.7018 0. UNIT-DEF. Idempotent on identical (dim, scale, offset); errors on conflicting redefinition.

UNIT-INFO
  • ( s:string -- ...dim8:integer 8:integer scale:number offset:number )

Lookup symbol; push 8 dim exponents, then 8, then scale, then offset. Errors on unknown symbol.

UNIT-LIST
  • ( -- ...:string n:integer )

All registered unit symbols, bottom-to-TOS, then count.

UNIT-OF
  • ( q:quantity -- s:string )

Display unit symbol as string.

VALUE
  • ( q:quantity -- d:number )

Display-form value (strip unit).

Contact

Send us a message — we'll reply by email.