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}, Rational(1,1e1), :prefix], '' => [%w{c Centi centi}, Rational(1,1e2), :prefix], '' => [%w{m Milli milli}, Rational(1,1e3), :prefix], '' => [%w{u Micro micro}, Rational(1,1e6), :prefix], '' => [%w{n Nano nano}, Rational(1,1e9), :prefix], '' => [%w{p Pico pico}, Rational(1,1e12), :prefix], '' => [%w{f Femto femto}, Rational(1,1e15), :prefix], '' => [%w{a Atto atto}, Rational(1,1e18), :prefix], '' => [%w{z Zepto zepto}, Rational(1,1e21), :prefix], '' => [%w{y Yocto yocto}, Rational(1,1e24), :prefix], '<1>' => [%w{1},1,:prefix], # length units '' => [%w{m meter meters metre metres}, 1, :length, %w{} ], '' => [%w{in inch inches "}, Rational(254,10_000), :length, %w{}], '' => [%w{ft foot feet '}, Rational(3048,10_000), :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}, Rational(1,1e10), :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, :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 #}, Rational(8171193714040401,18014398509481984), :mass, %w{}], '' => [%w{oz ounce ounces}, Rational(8171193714040401,288230376151711744), :mass, %w{}], '' => [%w{g gram grams gramme grammes},Rational(1,1e3),:mass, %w{}], #area ''=>[%w{hectare}, 10000, :area, %w{ }], ''=>[%w(acre acres), 4046.85642, :area, %w{ }], ''=>[%w(sqft), 1, :area, %w{ }], #volume '' => [%w{l L liter liters litre litres}, Rational(1,1e3), :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{ }], #volumetric flow '' => [%w{cfm CFM CFPM}, (18435447/39062500000), :volumetric_flow, %w{ }, %w{}], #speed '' => [%w{kph}, 0.277777778, :speed, %w{}, %w{}], '' => [%w{mph}, 0.44704, :speed, %w{}, %w{}], '' => [%w{kt kn kts knot knots}, 0.514444444, :speed, %w{}, %w{}], '' => [%w{fps}, 0.3048, :speed, %w{}, %w{}], #acceleration '' => [%w{gee}, 9.80655, :acceleration, %w{}, %w{ }], #temperature_difference '' => [%w{degK kelvin}, 1, :temperature, %w{}], '' => [%w{degC celsius celsius centigrade}, 1, :temperature, %w{}], '' => [%w{degF fahrenheit}, Rational(1,1.8), :temperature, %w{}], '' => [%w{degR rankine}, Rational(1,1.8), :temperature, %w{}], '' => [%w{tempK}, 1, :temperature, %w{}], '' => [%w{tempC}, 1, :temperature, %w{}], '' => [%w{tempF}, Rational(1,1.8), :temperature, %w{}], '' => [%w{tempR}, Rational(1,1.8), :temperature, %w{}], #time ''=> [%w{s sec second seconds}, 1, :time, %w{}], ''=> [%w{min minute minutes}, 60, :time, %w{}], ''=> [%w{h hr hrs hour hours}, 3600, :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, :pressure, %w{},%w{ }], '' => [%w{bar bars}, 100000, :pressure, %w{},%w{ }], '' => [%w{mmHg}, 133.322368,:pressure, %w{},%w{ }], '' => [%w{inHg}, 3386.3881472,: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{ }], '' => [%w{inH2O}, 249.082052,:pressure, %w{},%w{ }], #viscosity '' => [%w{P poise}, Rational(1,10), :viscosity, %w{},%w{ } ], '' => [%w{St stokes}, Rational(1,1e4), :viscosity, %w{ }, %w{}], #substance '' => [%w{mol mole}, 1, :substance, %w{}], #concentration '' => [%w{M molar}, 1000, :concentration, %w{}, %w{ }], '' => [%w{wt% wtpercent}, 10, :concentration, %w{}, %w{ }], #activity '' => [%w{kat katal Katal}, 1, :activity, %w{}, %w{}], '' => [%w{U enzUnit}, 16.667e-16, :activity, %w{}, %w{}], #capacitance '' => [%w{F farad Farad}, 1, :capacitance, %w{ }, %w{ }], #charge '' => [%w{C coulomb Coulomb}, 1, :charge, %w{ }], #current '' => [%w{A Ampere ampere amp amps}, 1, :current, %w{}], #conductance '' => [%w{S Siemens siemens}, 1, :resistance, %w{ }, %w{ }], #inductance '' => [%w{H Henry henry}, 1, :inductance, %w{ }, %w{ }], #potential '' => [%w{V Volt volt volts}, 1, :potential, %w{ }, %w{ }], #resistance '' => [%w{Ohm ohm}, 1, :resistance, %w{ },%w{ }], #magnetism '' => [%w{Wb weber webers}, 1, :magnetism, %w{ }, %w{ }], '' => [%w{T tesla teslas}, 1, :magnetism, %w{}, %w{ }], '' => [%w{G gauss}, Rational(1,1e4), :magnetism, %w{}, %w{ }], '' => [%w{Mx maxwell maxwells}, Rational(1,1e8), :magnetism, %w{ }, %w{ }], '' => [%w{Oe oersted oersteds}, 250.0/Math::PI, :magnetism, %w{}, %w{}], #energy '' => [%w{J joule Joule joules}, 1, :energy, %w{ }, %w{ }], '' => [%w{erg ergs}, Rational(1,1e7), :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, :force, %w{ }, %w{ }], '' => [%w{dyn dyne}, Rational(1,1e5), :force, %w{ }, %w{ }], '' => [%w{lbf pound-force}, 4.448222, :force, %w{ }, %w{ }], #frequency '' => [%w{Hz hertz Hertz}, 1, :frequency, %w{<1>}, %{}], #angle '' =>[%w{rad radian radian radians}, 1, :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, :solid_angle, %w{}], #rotation '' => [%w{rotation}, 2.0*Math::PI, :angle, %w{}], '' =>[%w{rpm}, 2.0*Math::PI / 60.0, :angular_velocity, %w{}, %w{}], #memory '' =>[%w{B byte}, 1, :memory, %w{}], '' =>[%w{b bit}, 0.125, :memory, %w{}], #currency ''=>[%w{USD dollar}, 1, :currency, %w{}], '' =>[%w{cents}, Rational(1,100), :currency, %w{}], #luminosity '' => [%w{cd candela}, 1, :luminosity, %w{}], '' => [%w{lm lumen}, 1, :luminous_power, %w{ }], '' =>[%w{lux}, 1, :illuminance, %w{ }, %w{ }], #power '' => [%w{W watt watts}, 1, :power, %w{ }, %w{ }], '' => [%w{hp horsepower}, 745.699872, :power, %w{ }, %w{ }], #radiation '' => [%w{Gy gray grays}, 1, :radiation, %w{ }, %w{ }], '' => [%w{R roentgen}, 0.009330, :radiation, %w{ }, %w{ }], '' => [%w{Sv sievert sieverts}, 1, :radiation, %w{ }, %w{ }], '' => [%w{Bq bequerel bequerels}, 1, :radiation, %w{<1>},%w{}], '' => [%w{Ci curie curies}, 3.7e10, :radiation, %w{<1>},%w{}], # rate '' => [%w{cpm}, Rational(1,60), :rate, %w{},%w{}], '' => [%w{dpm}, Rational(1,60), :rate, %w{},%w{}], '' => [%w{bpm}, Rational(1,60), :rate, %w{},%w{}], #resolution / typography '' => [%w{dot dots}, 1, :resolution, %w{}], '' => [%w{pixel px}, 1, :resolution, %w{}], '' => [%w{ppi}, 1, :resolution, %w{}, %w{}], '' => [%w{dpi}, 1, :typography, %w{}, %w{}], '' => [%w{pica}, 0.00423333333 , :typography, %w{}], '' => [%w{point pt}, 0.000352777778, :typography, %w{}], #other '' => [%w{cells cell}, 1, :counting, %w{}], '' => [%w{each}, 1, :counting, %w{}], '' => [%w{count}, 1, :counting, %w{}], '' => [%w{bp}, 1, :counting, %w{}], '' => [%w{nt}, 1, :counting, %w{}], '' => [%w{molecule molecules}, 1, :counting, %w{<1>}], '' => [%w{doz dz dozen},12,:prefix_only, %w{}], ''=> [%w{% percent}, Rational(1,100), :prefix_only, %w{<1>}], '' => [%w{ppm},Rational(1,1e6),:prefix_only, %w{<1>}], '' => [%w{ppt},Rational(1,1e9),:prefix_only, %w{<1>}], '' => [%w{gr gross},144, :prefix_only, %w{ }], '' => [%w{dB decibel decibels}, 1, :logarithmic, %w{}] } # doc end