summaryrefslogtreecommitdiff
path: root/src/main/resources/unitsfile.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/unitsfile.txt')
-rw-r--r--src/main/resources/unitsfile.txt267
1 files changed, 267 insertions, 0 deletions
diff --git a/src/main/resources/unitsfile.txt b/src/main/resources/unitsfile.txt
new file mode 100644
index 0000000..eafe885
--- /dev/null
+++ b/src/main/resources/unitsfile.txt
@@ -0,0 +1,267 @@
+# A file for the units in my unit converter program
+
+# SI Base Units
+# ! means "look for an existing unit which I will load at the start"
+# This is necessary because every unit must be defined by others, and I need somewhere to start.
+
+metre !
+kilogram !
+second !
+ampere !
+kelvin !
+mole !
+candela !
+
+# Symbols and aliases for base units
+
+meter metre
+m metre
+kg kilogram
+s second
+A ampere
+K kelvin
+mol mole
+cd candela
+
+# the bit and byte, units of information
+
+bit !
+b bit
+byte 8 bit
+B byte
+
+# SI prefixes
+
+deca- 10
+deka- deca
+hecto- 100
+kilo- 1e3
+mega- 1e6
+giga- 1e9
+tera- 1e12
+peta- 1e15
+exa- 1e18
+zetta- 1e21
+yotta- 1e24
+
+deci- 1e-1
+centi- 1e-2
+milli- 1e-3
+micro- 1e-6
+nano- 1e-9
+pico- 1e-12
+femto- 1e-15
+atto- 1e-18
+zepto- 1e-21
+yocto- 1e-24
+
+da- deca
+D- deca
+h- hecto
+H- hecto
+k- kilo
+K- kilo
+M- mega
+G- giga
+T- tera
+P- peta
+E- exa
+Z- zetta
+Y- yotta
+
+d- deci
+c- centi
+m- milli
+u- micro
+n- nano
+p- pico
+f- femto
+a- atto
+z- zepto
+y- yocto
+
+# Binary prefixes (i.e. metric but 1024 replaces 1000)
+
+kibi- 1024^1
+mebi- 1024^2
+gibi- 1024^3
+tebi- 1024^4
+pebi- 1024^5
+exbi- 1024^6
+Ki- kibi
+Mi- mebi
+Gi- gibi
+Ti- tebi
+Pi- pebi
+Ei- exbi
+
+# Derived SI units
+# Note: it is best to have these before any non-SI units
+
+newton kg m / s^2
+N newton
+pascal N / m^2
+Pa pascal
+joule N m
+J joule
+watt J/s
+W watt
+coulomb A s
+C coulomb
+volt W/A
+V volt
+ohm V/A
+siemens A/V
+S siemens
+farad C/V
+F farad
+weber V s
+Wb weber
+henry V s / A
+H henry
+tesla Wb / m^2
+T tesla
+hertz 1 / s
+Hz hertz
+
+gram millikg
+g gram
+
+# Angle units and constants
+
+# Tau is the circle constant, equal to a circle's diameter divided by its radius
+tau 6.28318530717958
+# Another common circle constant
+pi tau / 2
+
+radian m / m
+rad radian
+steradian m^2 / m^2
+sr steradian
+degree tau / 360 radian
+deg degree
+° degree
+
+# Nonlinear units, which are not supported by the file reader and must be defined manually
+# Use tempC(100) for 100 degrees Celsius
+
+tempCelsius !
+tempFahrenheit !
+tempC tempCelsius
+tempF tempFahrenheit
+
+# Common time units
+minute 60 second
+min minute
+hour 3600 second
+h hour
+day 86400 second
+d day
+week 7 day
+wk week
+julianyear 365.25 day
+gregorianyear 365.2425 day
+gregorianmonth gregorianyear / 12
+
+# Other non-SI "metric" units
+litre 0.001 m^3
+liter litre
+l litre
+L litre
+tonne 1000 kg
+t tonne
+are 100 m^2
+hectare hectoare
+arcminute 1 / 60 degree
+arcmin arcminute
+arcsecond 1 / 60 arcminute
+arcsec arcsecond
+
+# constants
+waterdensity kilogram / litre
+
+# Imperial length units
+foot 0.3048 m
+ft foot
+inch foot / 12
+in inch
+yard 3 foot
+yd yard
+mile 1760 yard
+mi mile
+
+# Compressed notation
+kph km / hour
+mph mile / hour
+
+# Imperial weight units
+pound 0.45359237 kg
+lb pound
+ounce pound / 16
+oz ounce
+stone 14 lb
+UShundredweight 100 lb
+UKhundredweight 8 stone
+USimperialton 20 UShundredweight
+UKimperialton 10 UKhundredweight
+
+# Imperial volume units
+UKfluidounce ounce / waterdensity
+UKfloz UKfluidounce
+UKcup 10 UKfloz
+UKpint 2 UKcup
+UKquart 2 UKpint
+UKgallon 4 UKquart
+UKgal UKgallon
+
+USgallon 231 inch^3
+USgal USgallon
+USquart USgallon / 4
+USpint USquart / 2
+UScup USpint / 2
+USfluidounce UScup / 8
+USfloz USfluidounce
+UStablespoon USfluidounce / 2
+UStbsp UStablespoon
+USteaspoon UStablespoon / 3
+UStsp USteaspoon
+
+# Metric versions!
+# tsp = 5 mL, tbsp = 15 mL, floz = 30 mL, cup = 240 mL, pint = 480 mL, quart = 960 mL, gallon = 3840 mL
+# only metrictsp, metrictbsp and metriccup are common, the rest are derived from the US formulae with 240 mL cup
+metricteaspoon 5 mL
+teaspoon metricteaspoon
+tsp metricteaspoon
+metrictablespoon 3 metricteaspoon
+tablespoon metrictablespoon
+tbsp metrictablespoon
+metricfluidounce 2 metrictablespoon
+metriccup 8 metricfluidounce
+cup metriccup
+metricpint 2 metriccup
+pint metricpint
+metricquart 2 metricpint
+quart metricquart
+metricgallon 4 metricquart
+
+# Energy units
+calorie 4.18 J
+cal calorie
+Calorie kilocalorie
+Cal Calorie
+Wh W h
+
+# Extra units to only include in the dimension-based converter
+km km
+cm cm
+mm mm
+mg mg
+mL mL
+ml ml
+kJ kJ
+MJ MJ
+kWh kWh
+m/s m / s
+km/h km / h
+ft/s foot / s
+mi/h mile / hour \ No newline at end of file