# Conversion of Units

This is a unit conversion tool that was written in C++ in order to support the communication of medical information. The class Unit (hierarchy) works based on a concept of a minimal vector of basic dimensions. However, I decided to change the set of SI base units but you will not notice it and the conversions are of course SI compliant.

What is special about this unit converter is that you can prepend any ISO prefix to any unit (like k for km of f for fm). Since the prefices are handled separately from the units, the database of known units is quite compact and very easy to extend. The most important feature is that you cannot just enter simple (``atomic'') units but also any valid ISO-2955 term like: kg.m/s2.

A term of units is expressed according to the ISO standard 2955 using the following operators:

`.'
multiplication
`/'
division

The exponentiation is expressed by writing an (integer) number directly behind the units symbol, e.g. a cubic meter is expressed as `m2'. Negative exponents are allowed by writing a `-' in front of the number. The use of parentheses to overcome left to right association is not allowed. Thus, the Newton is defined as `kg/m/s2'. Note that because there are no parentheses and operators strictly associate left to right, `kg/m.s2' is not a correct representation for the Newton. Using negative exponents `kg.m-1.s-2' is again the Newton. Parentheses in units are a part of the unit symbol itself. Thus, `m(H2O)' is an allowed unit symbol that can be defined distinct from `m(Hg)' and the base unit of length `m'.

Even those units which are usually tricky to convert are supported like:

• m (Hg) or m (H2O)
• Units with non-proportional conversions, like °F and °C or various units of level, like bel, dB (SPL, V, mV, µV, W, mW ...).
• pH which is convertible to mol/l and vice versa (of course).

Unlike SI, I do not regard the mole as a special dimension, but rather handle it as Avogadro's number. Thus you can convert mol/l into /l. (Did you know that a solution of pH 4 has about 60 free protons per atto-liter? Try it: convert 4 ph to /al!)

The class Unit is currently integrated in a much larger class library for medical communication and does depend on it. I did not had the time to reduce the dependencies in order to make this units converter an independent program. Contact me, if you are interested in it, so we can find a way.

Value: From Unit: To Unit:

this is a case insensitive version of the unit converter

## Available Units

The following table shows any unit that is currently known to the converter. It is prepared for HTML but reflects quite well how easily you can add new units to the database.

 Base Units Pseudo Units, i.e. those whose dimension is 1 Angle Space Time Symbol Type as Name Definition Dimension m m meter [1,0,0,0,0,0,0],0 s s second [0,1,0,0,0,0,0],0 g g gram [0,0,1,0,0,0,0],0 C c Coulomb [0,0,0,1,0,0,0],0 K k Kelvin [0,0,0,0,1,0,0],0 cd cd candela [0,0,0,0,0,1,0],0 rad rad radian [0,0,0,0,0,0,1],0 1 1 one [0,0,0,0,0,0,0],0 10 10* ten [0,0,0,0,0,0,0],1 % % percent 1 10*-2 sr sr steradian 1 rad+2 circ circ circle 6.2831853071795864768 rad sph shp sphere 3.1830988618379067154 10*-1.circ+2 ° deg degree (angular) 2.7777777777777777778 10*-3.circ " mnt angular minute 1.6666666666666666667 10*-2.deg gon gon gon (grade) 2.5 10*-3.circ l l liter 1 dm3 h hr hour 3.6 10*3.s min min minute 6 10*1.s d d day 8.64 10*4.s ann ann year 3.1536 10*7.s Hz hz Herz 1 /s N n Newton 1 kg.m/s2 p p pond 9.80665 g.m/s2 J j Joule 1 n.m cal cal calorie 4.1868 j W w Watt 1 j/s Pa pal Pascal 1 n/m2 bar bar bar 1 10*5.pal m (H2O) m(h2o) meter of water column 9.806650 pal m (Hg) m(hg) meter of mercury column 133.3220 pal °C cel degree Celsius cel_f(1 k) °F degf degree Fahrenheit degf_f(0.5555555555555555556 k) A a Ampere 1 c/s V v Volt 1 j/c Ohm ohm Ohm 1 v/a S sie Siemens 1 a/v F f Farad 1 c/v Wb wb Weber (magnetic flux) 1 v.s T t Tesla (magnetic inductance) 1 wb/m2 H hy Henry (inductance) 1 wb/a lm lm lumen (luminous flux) 1 cd/sr lx lx lux (illuminance) 1 lm/m2 mol mol mole, Avogadro's number 6.022137 10*23 val val val, equivalents 6.022137 10*23 eq eq equivalents 6.022137 10*23 pH ph pH ph_f(1 mol/l) e e elementary charge 1.6021892 10*-19.c eV ev electronvolt 1.602177 10*-19.j u u atomic mass unit 1.6605655 10*-24.g Bq bq Bequerel (activity) 1 /s Gy gy Gray (energy dose) 1 j/s bel bel bel f_ln(1 1) dB (SPL) db(spl) decibel sound pressure f_20_lg(2 10*-5.pal) dB (V) db(v) decibel volts f_20_lg(1 v) dB (mV) db(mv) decibel millivolts f_20_lg(1 mv) dB (uV) db(uv) decibel mycrovolts f_20_lg(1 uv) dB (W) db(w) decibel watts f_10_lg(1 w) dB (kW) db(kw) decibel kilowatts f_10_lg(1 kw) Sv sv(a) Sievert (alpha rays) 0.04 gy Sv sv(b) Sievert (beta rays) 1 gy Sv sv(g) Sievert (gamma rays) 1 gy Sv sv(x) Sievert (X-rays) 1 gy Sv sv(n) Sievert (neutrons) 0.2 gy Sv sv(p) Sievert (protons) 0.1 gy tot tot particles total count 1 1 cfu cfu colony forming units 1 1 ppm ppm parts per million 1 10*-6 ppb ppb parts per billion 1 10*-9 i.U. iu international units 1 1 kat kat katal 1 mol/s

If you think this table contains errors or needs to be extended, please let me know!

## Prefices

 Symbol Type as Name lg(Value) E ex exa 18 P pe peta 15 T t tera 12 G g giga 9 M ma mega 6 k k kilo 3 h h hecto 2 da da deka 1 d d deci -1 c c centi -2 m m milli -3 µ u micro -6 n n nano -9 p p pico -12 f f fempto -15 a a atto -18