units

Unit definitions and surrounding Value system.

A quick note on what this module does not do: it does not set out a complete unit system, and you will experience issues if you use it that way.

This system is designed purely for the ergonomic specification of units of a quantity at display time, and because of this, it is designed to precisely mirror the form of the expression as it is written in code. The below highlights a particular quirk of this.

>>> 1 / (KILO * VOLT) == 1 * KILO / VOLT
True

This is because the system stores units as they would be written, and you would write \(\mathrm{1 / kV = 1 kV^{-1}}\) and not \(\mathrm{1 k^{-1} V^{-1}}\).

Available prefixes

Prefix variable

Displayed as

QUETTA

Q

RONNA

R

YOTTA

Y

ZETTA

Z

EXA

E

PETA

P

TERA

T

GIGA

G

MEGA

M

KILO

k

HECTO

h

DECA

da

DECI

d

CENTI

c

MILLI

m

MICRO

µ

NANO

n

PICO

p

FEMTO

f

ATTO

a

ZEPTO

z

YOCTO

y

RONTO

r

QUECTO

q

YOBI

Yi

ZEBI

Zi

EXBI

Ei

PEBI

Pi

TEBI

Ti

GIBI

Gi

MEBI

Mi

KIBI

Ki

Available units

Length/area/volume

Unit variable

Displayed as

METRE

m

METER

ANGSTROM

Å

MICRON

μm

LITRE

L

LITER

Mass

Unit variable

Displayed as

GRAM

g

Time/frequency

Unit variable

Displayed as

SECOND

s

MINUTE

min

HOUR

hr

HERTZ

Hz

Electricity

Unit variable

Displayed as

AMP

A

VOLT

V

OHM

Ω

SIEMENS

S

FARAD

F

HENRY

H

COULOMB

C

Temperature

Unit variable

Displayed as

KELVIN

K

CELSIUS

°C

Illumination

Unit variable

Displayed as

CANDELA

cd

LUMEN

lm

LUX

lx

Quantity

Unit variable

Displayed as

MOLE

mol

Angles

Unit variable

Displayed as

DEGREE

°

RADIAN

rad

STERADIAN

sr

Energy and power

Unit variable

Displayed as

JOULE

J

ELECTRONVOLT

eV

WATT

W

DECIBEL

dB

Force and pressure

Unit variable

Displayed as

NEWTON

N

PASCAL

Pa

BAR

bar

Magnetism

Unit variable

Displayed as

WEBER

Wb

TESLA

T

Digital storage

Unit variable

Displayed as

BIT

b

BYTE

B

Classes

E

Unit representing scientific notation.

Unit

An SI unit or prefix.

UnitSequence

A sequence of individual units.

Value

Representation of a quantity with units for display purposes.