class Unit < Numeric UNIT_DEFINITIONS = { # prefixes '' => [%w{googol}, 1e100, :prefix], '' => [%w{Ki Kibi kibi}, 2**10, :prefix], '' => [%w{Mi Mebi mebi}, 2**20, :prefix], '' => [%w{Gi Gibi gibi}, 2**30, :prefix], '' => [%w{Ti Tebi tebi}, 2**40, :prefix], '' => [%w{Pi Pebi pebi}, 2**50, :prefix], '' => [%w{Ei Exi exi}, 2**60, :prefix], '' => [%w{Zi Zebi zebi}, 2**70, :prefix], '' => [%w{Yi Yebi yebi}, 2**80, :prefix], '' => [%w{Y Yotta yotta}, 1e24, :prefix], '' => [%w{Z Zetta zetta}, 1e21, :prefix], '' => [%w{E Exa exa}, 1e18, :prefix], '' => [%w{P Peta peta}, 1e15, :prefix], '' => [%w{T Tera tera}, 1e12, :prefix], '' => [%w{G Giga giga}, 1e9, :prefix], '' => [%w{M Mega mega}, 1e6, :prefix], '' => [%w{k kilo}, 1e3, :prefix], '' => [%w{h Hecto hecto}, 1e2, :prefix], '' => [%w{da Deca deca deka}, 1e1, :prefix], '' => [%w{d Deci deci}, 1e-1, :prefix], '' => [%w{c Centi centi}, 1e-2, :prefix], '' => [%w{m Milli milli}, 1e-3, :prefix], '' => [%w{u Micro micro}, 1e-6, :prefix], '' => [%w{n Nano nano}, 1e-9, :prefix], '' => [%w{p Pico pico}, 1e-12, :prefix], '' => [%w{f Femto femto}, 1e-15, :prefix], '' => [%w{a Atto atto}, 1e-18, :prefix], '' => [%w{z Zepto zepto}, 1e-21, :prefix], '' => [%w{y Yocto yocto}, 1e-24, :prefix], '<1>' => [%w{1},1,:prefix], # length units '' => [%w{m meter meters metre metres}, 1.0, :length, %w{} ], '' => [%w{in inch inches "}, 0.0254, :length, %w{}], '' => [%w{ft foot feet '}, 0.3048, :length, %w{}], '' => [%w{yd yard yards}, 0.9144, :length, %w{}], '' => [%w{mi mile miles "}, 1609.344, :length, %w{}], '' => [%w{nmi}, 1852, :length, %w{}], ''=> [%w{league leagues}, 4828, :length, %w{}], ''=> [%w{furlong furlongs}, 201.2, :length, %w{}], '' => [%w{rd rod rods}, 5.029, :length, %w{}], '' => [%w{mil mils}, 0.0000254, :length, %w{}], '' =>[%w{ang angstrom angstroms}, 1e-10, :length, %w{}], '' => [%w{fathom fathoms}, 1.829, :length, %w{}], '' => [%w{pica picas}, 0.004217, :length, %w{}], '' => [%w{pt point points}, 0.0003514, :length, %w{}], '' => [%w{z red-shift}, 1.302773e26, :length, %w{}], '' => [%w{AU astronomical-unit}, 149597900000, :length, %w{}], ''=>[%w{ls light-second}, 299792500, :length, %w{}], ''=>[%w{lmin light-minute}, 17987550000, :length, %w{}], '' => [%w{ly light-year}, 9460528000000000, :length, %w{}], '' => [%w{pc parsec parsecs}, 30856780000000000, :length, %w{}], #mass '' => [%w{kg kilogram kilograms}, 1.0, :mass, %w{}], '' => [%w{u AMU amu}, 6.0221415e26, :mass, %w{}], '' => [%w{Da Dalton Daltons dalton daltons}, 6.0221415e26, :mass, %w{}], '' => [%w{slug slugs}, 14.5939029, :mass, %w{}], '' => [%w{tn ton}, 907.18474, :mass, %w{}], ''=>[%w{tonne}, 1000, :mass, %w{}], '' => [%w{ct carat carats}, 0.0002, :mass, %w{}], '' => [%w{lbs lb pound pounds #}, 0.45359237, :mass, %w{}], '' => [%w{oz ounce ounces}, 0.0283495231, :mass, %w{}], '' => [%w{g gram grams gramme grammes},1e-3,:mass, %w{}], #area ''=>[%w{hectare}, 10000, :area, %w{ }], ''=>[%w(acre acres), 4046.85642, :area, %w{ }], #volume '' => [%w{l L liter liters litre litres}, 0.001, :volume, %w{ }], ''=> [%w{gal gallon gallons}, 0.0037854118, :volume, %w{ }], ''=> [%w{qt quart quarts}, 0.00094635295, :volume, %w{ }], ''=> [%w{pt pint pints}, 0.000473176475, :volume, %w{ }], ''=> [%w{cu cup cups}, 0.000236588238, :volume, %w{ }], ''=> [%w{floz fluid-ounce}, 2.95735297e-5, :volume, %w{ }], ''=> [%w{tbs tablespoon tablespoons}, 1.47867648e-5, :volume, %w{ }], ''=> [%w{tsp teaspoon teaspoons}, 4.92892161e-6, :volume, %w{ }], #speed '' => [%w{kph}, 0.277777778, :speed, %w{}, %w{}], '' => [%w{mph}, 0.44704, :speed, %w{}, %w{}], '' => [%w{kn knot knots}, 0.514444444, :speed, %w{}, %w{}], '' => [%w{fps}, 0.3048, :speed, %w{}, %w{}], #temperature_difference '' => [%w{degK kelvin Kelvin}, 1.0, :temperature, %w{}], '' => [%w{degC celcius Celcius}, 1.0, :temperature, %w{}], '' => [%w{degF farenheit Farenheit}, 1.8, :temperature, %w{}], '' => [%w{degR rankine Rankine}, 1.8, :temperature, %w{}], '' => [%w{tempK}, 1.0, :temperature, %w{}], '' => [%w{tempC}, 1.0, :temperature, %w{}], '' => [%w{tempF}, 1.0, :temperature, %w{}], '' => [%w{tempR}, 1.0, :temperature, %w{}], #time ''=> [%w{s sec second seconds}, 1.0, :time, %w{}], ''=> [%w{min minute minutes}, 60.0, :time, %w{}], ''=> [%w{h hr hrs hour hours}, 3600.0, :time, %w{}], ''=> [%w{d day days}, 3600*24, :time, %w{}], ''=> [%w{wk week weeks}, 7*3600*24, :time, %w{}], ''=> [%w{fortnight fortnights}, 1209600, :time, %W{}], ''=> [%w{y yr year years annum}, 31556926, :time, %w{}], ''=>[%w{decade decades}, 315569260, :time, %w{}], ''=>[%w{century centuries}, 3155692600, :time, %w{}], #pressure '' => [%w{Pa pascal Pascal}, 1.0, :pressure, %w{},%w{ }], '' => [%w{bar bars}, 100000, :pressure, %w{},%w{ }], '' => [%w{mmHg}, 133.322368,:pressure, %w{},%w{ }], '' => [%w{torr}, 133.322368,:pressure, %w{},%w{ }], '' => [%w{bar}, 100000,:pressure, %w{},%w{ }], '' => [%w{atm ATM atmosphere atmospheres}, 101325,:pressure, %w{},%w{ }], '' => [%w{psi}, 6894.76,:pressure, %w{},%w{ }], '' => [%w{cmH2O}, 98.0638,:pressure, %w{},%w{ }], #viscosity '' => [%w{P poise}, 0.1, :viscosity, %w{},%w{ } ], '' => [%w{St stokes}, 1e-4, :viscosity, %w{ }, %w{}], #substance '' => [%w{mol mole}, 1.0, :substance, %w{}], #concentration '' => [%w{M molar}, 1000, :concentration, %w{}, %w{ }], #activity '' => [%w{kat katal Katal}, 1.0, :activity, %w{}, %w{}], '' => [%w{U enzUnit}, 16.667e-16, :activity, %w{}, %w{}], #capacitance '' => [%w{F farad Farad}, 1.0, :capacitance, %w{}], #charge '' => [%w{C coulomb Coulomb}, 1.0, :charge, %w{ }], #current '' => [%w{A Ampere ampere amp amps}, 1.0, :current, %w{}], #conductance '' => [%w{S Siemens siemens}, 1.0, :resistance, %w{ }, %w{ }], #inductance '' => [%w{H Henry henry}, 1.0, :inductance, %w{ }, %w{ }], #potential '' => [%w{V Volt volt volts}, 1.0, :potential, %w{ }, %w{ }], #resistance '' => [%w{Ohm ohm}, 1.0, :resistance, %w{ },%w{ }], #magnetism '' => [%w{Wb weber webers}, 1.0, :magnetism, %w{ }, %w{ }], '' => [%w{T tesla teslas}, 1.0, :magnetism, %w{}, %w{ }], '' => [%w{G gauss}, 1e-4, :magnetism, %w{}, %w{ }], '' => [%w{Mx maxwell maxwells}, 1e-8, :magnetism, %w{ }, %w{ }], '' => [%w{Oe oersted oersteds}, 250.0/Math::PI, :magnetism, %w{}, %w{}], #energy '' => [%w{J joule Joule joules}, 1.0, :energy, %w{ }, %w{ }], '' => [%w{erg ergs}, 1e-7, :energy, %w{ }, %w{ }], '' => [%w{BTU btu BTUs}, 1055.056, :energy, %w{ }, %w{ }], '' => [%w{cal calorie calories}, 4.18400, :energy,%w{ }, %w{ }], '' => [%w{Cal Calorie Calories}, 4184.00, :energy,%w{ }, %w{ }], '' => [%w{th therm therms Therm}, 105480400, :energy,%w{ }, %w{ }], #force '' => [%w{N Newton newton}, 1.0, :force, %w{ }, %w{}], '' => [%w{dyn dyne}, 1e-5, :force, %w{ }, %w{}], '' => [%w{lbf pound-force}, 4.448222, :force, %w{ }, %w{}], #frequency '' => [%w{Hz hertz Hertz}, 1.0, :frequency, %w{<1>}, %{}], #angle '' =>[%w{rad radian radian}, 1.0, :angle, %w{}], '' =>[%w{deg degree degrees}, Math::PI / 180.0, :angle, %w{}], '' =>[%w{grad gradian grads}, Math::PI / 200.0, :angle, %w{}], '' => [%w{sr steradian steradians}, 1.0, :solid_angle, %w{}], #rotation '' => [%w{rotation}, 2.0*Math::PI, :rotation, %w{}], '' =>[%w{rpm}, 2.0*Math::PI / 60.0, :rotation, %w{}, %w{}], #memory '' =>[%w{B byte}, 1.0, :memory, %w{}], '' =>[%w{b bit}, 0.125, :memory, %w{}], #money ''=>[['$','dollar','USD'], 1.0, :currency, %w{}], '' =>[%w{cents}, 0.01, :currency, %w{}], #luminosity '' => [%w{cd candela}, 1.0, :luminosity, %w{}], '' => [%w{lm lumen}, 1.0, :luminous_power, %w{ }], '' =>[%w{lux}, 1.0, :illuminance, %w{ }, %w{ }], #power '' => [%w{W watt watts}, 1.0, :power, %w{ }, %w{ }], '' => [%w{hp horsepower}, 745.699872, :power, %w{ }, %w{ }], #radition '' => [%w{Gy gray grays}, 1.0, :radiation, %w{ }, %w{ }], '' => [%w{R roentgen}, 0.009330, :radiation, %w{ }, %w{ }], '' => [%w{Sv sievert sieverts}, 1.0, :radiation, %w{ }, %w{ }], '' => [%w{Bq bequerel bequerels}, 1.0, :radiation, %w{<1>},%w{}], '' => [%w{Ci curie curies}, 3.7e10, :radiation, %w{<1>},%w{}], '' => [%w{cpm}, 1.0/60.0, :radiation, %w{<1>},%w{}], '' => [%w{dpm}, 1.0/60.0, :radiation, %w{<1>},%w{}], #other '' => [%w{each}, 1.0, :counting, %w{}], '' => [%w{count}, 1.0, :counting, %w{}], '' => [%w{bp}, 1.0, :counting, %w{}], '' => [%w{nt}, 1.0, :counting, %w{}], '' => [%w{molecule molecules}, 1.0, :counting, %w{}], '' => [%w{doz dz dozen},12.0,:prefix_only, %w{}], ''=> [%w{% percent}, 0.01, :prefix_only, %w{}], '' => [%w{ppm},1e-6,:prefix_only, %w{}], '' => [%w{ppt},1e-9,:prefix_only, %w{}], '' => [%w{gr gross},144.0, :prefix_only, %w{ }], '' => [%w{dB decibel decibels}, 1.0, :logarithmic, %w{}] } # doc end