Dimensions & Scales
This reference provides a complete list of the built-in physical dimensions, prefix scales, and unique units supported by Zigma.
The 7 SI Base Dimensions
Zigma tracks physics using the 7 standard SI base dimensions. Every unit in the language is internally represented as a combination of these dimensions.
| Indicator | Dimension | SI Base Unit |
|---|---|---|
| L | Length | meter (m) |
| M | Mass | kilogram (kg) |
| T | Time | second (s) |
| I | Electric Current | ampere (A) |
| Tp | Temperature | kelvin (K) |
| N | Amount of Substance | mole (mol) |
| J | Luminous Intensity | candela (cd) |
Prefix Scales
Any dimension can be prefixed to scale its value. Zigma supports SI prefixes from Peta ($10^{15}$) to femto ($10^{-15}$).
| Prefix | Symbol | Multiplier | Example |
|---|---|---|---|
| Peta | P |
$10^{15}$ | Pm (Petameter) |
| Tera | T |
$10^{12}$ | TW (Terawatt) |
| Giga | G |
$10^{9}$ | GHz (Gigahertz) |
| Mega | M |
$10^{6}$ | MJ (Megajoule) |
| kilo | k |
$10^{3}$ | km (kilometer) |
| hecto | h |
$10^{2}$ | hPa (hectopascal) |
| deca | da |
$10^{1}$ | dam (decameter) |
| (base) | - | $10^{0}$ | m (meter) |
| deci | d |
$10^{-1}$ | dm (decimeter) |
| centi | c |
$10^{-2}$ | cm (centimeter) |
| milli | m |
$10^{-3}$ | mm (millimeter) |
| micro | u |
$10^{-6}$ | um (micrometer) |
| nano | n |
$10^{-9}$ | nm (nanometer) |
| pico | p |
$10^{-12}$ | pm (picometer) |
| femto | f |
$10^{-15}$ | fm (femtometer) |
Unique Units
Unique units are scales tied to a specific dimension that do not follow the standard power-of-ten prefix system.
Time
min(60 s)hour(3600 s)year(31,536,000 s)
Imperial Units (Length & Mass)
- Length:
inch,ft(foot),yd(yard),mi(mile) - Mass:
oz(ounce),lb(pound),st(stone)
Keywords: in vs as
Zigma uses two distinct keywords for changing how a value is represented or stored.
in (Scale Conversion)
Changes the scale of a value (e.g., meters to millimeters). The underlying physical dimension remains the same.
a = 1 m
b = a in nm // Converts 1m to 1,000,000,000nm
as (Type Conversion)
Changes the underlying numeric type (e.g., f64 to i128) or the shape of a tensor.
a = 1 m
b = a as i128 // Stores the value as a 128-bit integer
You can also use it to set a variable with the same dimension of another.
It only copy the dimensions, not the scale. You need to redefine it.
You can use _ to use the same scale.
a = 1 mm
b = 1 as a // 1m
c = 1 as k a // 1km
d = 1 as _ a // 1mm
e = 1 as hour a // This is an error, hour cannot be converted to meter
Aliases
Aliases allow you to define custom names for complex dimensional formulas.
alias Tq as kg.m2/s2 // Torque
alias J as kg.m2/s2 // Joule
a = 1 Tq
b = 1 J
You can also include mathematical offsets in aliases (common for temperature scales):
alias degC as K - 273.15
alias Fahr as K * 9/5 - 459.67