Conversion Utils #87
Aliases: Conversion Utils
15 verbs · 392 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
dd_to_dms dh_to_hms | this none this | rxd | #87 | 5 |
dms_to_dd hms_to_dh | this none this | rxd | #87 | 7 |
rect_to_polar | this none this | rxd | #87 | 6 |
polar_to_rect | this none this | rxd | #87 | 6 |
F_to_C degF_to_degC | this none this | rxd | #87 | 3 |
C_to_F degC_to_degF | this none this | rxd | #87 | 3 |
convert | this none this | rxd | #87 | 26 |
_do_convert | this none this | rxd | #87 | 70 |
_try_metric_prefix | this none this | rxd | #87 | 111 |
_format_units | this none this | rxd | #87 | 15 |
K_to_C degK_to_degC | this none this | rxd | #87 | 3 |
C_to_K degC_to_degK | this none this | rxd | #87 | 3 |
F_to_R degF_to_degR | this none this | rxd | #87 | 3 |
R_to_F degR_to_degF | this none this | rxd | #87 | 3 |
_do_value | this none this | rxd | #87 | 5 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
basic_units | #87 | r | #29 | list of 9{"m", "kg", "s", "coul", "candela", "radian", "bit", "erlang", "kelvin"} |
pi | #87 | r | #29 | "3.14159265358979323846264338327950288" |
c | #87 | r | #29 | "2.99792458e8 m/sec" |
g | #87 | r | #29 | "9.80665 m/sec2" |
au | #87 | r | #29 | "1.49599e11 m" |
mole | #87 | r | #29 | "6.022045e23" |
e | #87 | r | #29 | "1.6020e-19 coul" |
abcoulomb | #87 | r | #29 | "10 coul" |
force | #87 | r | #29 | "g" |
slug | #87 | r | #29 | "lb g sec2/ft" |
mercury | #87 | r | #29 | "1.3157895 atm/m" |
hg | #87 | r | #29 | "mercury" |
torr | #87 | r | #29 | "mm hg" |
% | #87 | r | #29 | "1|100" |
percent | #87 | r | #29 | "%" |
cg | #87 | r | #29 | "centigram" |
atmosphere | #87 | r | #29 | "1.01325 bar" |
atm | #87 | r | #29 | "atmosphere" |
psi | #87 | r | #29 | "lb g/in2" |
bar | #87 | r | #29 | "1e6 dyne/cm2" |
chemamu | #87 | r | #29 | "1.66024e-24 g" |
physamu | #87 | r | #29 | "1.65979e-24 g" |
amu | #87 | r | #29 | "chemamu" |
chemdalton | #87 | r | #29 | "chemamu" |
dalton | #87 | r | #29 | "chemamu" |
physdalton | #87 | r | #29 | "physamu" |
dozen | #87 | r | #29 | "12" |
bakersdozen | #87 | r | #29 | "13" |
quire | #87 | r | #29 | "25" |
ream | #87 | r | #29 | "500" |
gross | #87 | r | #29 | "144" |
hertz | #87 | r | #29 | "1/sec" |
cps | #87 | r | #29 | "hertz" |
hz | #87 | r | #29 | "hertz" |
khz | #87 | r | #29 | "kilohz" |
mhz | #87 | r | #29 | "megahz" |
rutherford | #87 | r | #29 | "1e6/sec" |
degree | #87 | r | #29 | "1|180 pi radian" |
circle | #87 | r | #29 | "2 pi radian" |
turn | #87 | r | #29 | "2 pi radian" |
revolution | #87 | r | #29 | "360 degrees" |
rpm | #87 | r | #29 | "revolution/minute" |
grade | #87 | r | #29 | "1|400 circle" |
grad | #87 | r | #29 | "1|400 circle" |
sign | #87 | r | #29 | "1|12 circle" |
arcdeg | #87 | r | #29 | "1 degree" |
arcmin | #87 | r | #29 | "1|60 arcdeg" |
arcsec | #87 | r | #29 | "1|60 arcmin" |
karat | #87 | r | #29 | "1|24" |
proof | #87 | r | #29 | "1|200" |
mpg | #87 | r | #29 | "mile/gal" |
curie | #87 | r | #29 | "3.7e10/sec" |
stoke | #87 | r | #29 | "1 cm2/sec" |
steradian | #87 | r | #29 | "radian radian" |
sr | #87 | r | #29 | "steradian" |
sphere | #87 | r | #29 | "4 pi steradian" |
ps | #87 | r | #29 | "picosec" |
us | #87 | r | #29 | "microsec" |
ns | #87 | r | #29 | "nanosec" |
ms | #87 | r | #29 | "millisec" |
sec | #87 | r | #29 | "second" |
minute | #87 | r | #29 | "60 sec" |
min | #87 | r | #29 | "minute" |
hour | #87 | r | #29 | "60 min" |
hr | #87 | r | #29 | "hour" |
day | #87 | r | #29 | "24 hr" |
week | #87 | r | #29 | "7 day" |
quadrant | #87 | r | #29 | "5400 minute" |
fortnight | #87 | r | #29 | "14 day" |
year | #87 | r | #29 | "365.24219879 day" |
yr | #87 | r | #29 | "year" |
month | #87 | r | #29 | "1|12 year" |
mo | #87 | r | #29 | "month" |
decade | #87 | r | #29 | "10 year" |
century | #87 | r | #29 | "100 year" |
millenium | #87 | r | #29 | "1000 year" |
gm | #87 | r | #29 | "gram" |
myriagram | #87 | r | #29 | "10 kg" |
mg | #87 | r | #29 | "milligram" |
metricton | #87 | r | #29 | "1000 kg" |
gamma | #87 | r | #29 | "1e-6 g" |
metriccarat | #87 | r | #29 | "200 mg" |
quintal | #87 | r | #29 | "100 kg" |
lb | #87 | r | #29 | "0.45359237 kg" |
pound | #87 | r | #29 | "lb" |
lbf | #87 | r | #29 | "lb g" |
cental | #87 | r | #29 | "100 lb" |
stone | #87 | r | #29 | "14 lb" |
ounce | #87 | r | #29 | "1|16 lb" |
oz | #87 | r | #29 | "ounce" |
avdram | #87 | r | #29 | "1|16 oz" |
usdram | #87 | r | #29 | "1|8 oz" |
dram | #87 | r | #29 | "avdram" |
dr | #87 | r | #29 | "dram" |
grain | #87 | r | #29 | "1|7000 lb" |
gr | #87 | r | #29 | "grain" |
shortton | #87 | r | #29 | "2000 lb" |
ton | #87 | r | #29 | "shortton" |
longquarter | #87 | r | #29 | "28 lb" |
shortquarter | #87 | r | #29 | "500 lb" |
longton | #87 | r | #29 | "2240 lb" |
longhundredweight | #87 | r | #29 | "112 lb" |
shorthundredweight | #87 | r | #29 | "100 lb" |
wey | #87 | r | #29 | "252 lb" |
carat | #87 | r | #29 | "205.3 mg" |
scruple | #87 | r | #29 | "20 grain" |
pennyweight | #87 | r | #29 | "24 grain" |
apdram | #87 | r | #29 | "60 grain" |
apounce | #87 | r | #29 | "480 grain" |
appound | #87 | r | #29 | "5760 grain" |
cm | #87 | r | #29 | "centimeter" |
mm | #87 | r | #29 | "millimeter" |
km | #87 | r | #29 | "kilometer" |
parsec | #87 | r | #29 | "au radian/arcsec" |
pc | #87 | r | #29 | "parsec" |
nm | #87 | r | #29 | "nanometer" |
micron | #87 | r | #29 | "1e-6 meter" |
angstrom | #87 | r | #29 | "1e-8 meter" |
fermi | #87 | r | #29 | "1e-13 cm" |
point | #87 | r | #29 | "1|72.27 in" |
pica | #87 | r | #29 | "0.166044 inch" |
caliber | #87 | r | #29 | "0.01 in" |
barleycorn | #87 | r | #29 | "1|3 in" |
inch | #87 | r | #29 | "2.54 cm" |
in | #87 | r | #29 | "inch" |
mil | #87 | r | #29 | "0.001 in" |
palm | #87 | r | #29 | "3 in" |
hand | #87 | r | #29 | "4 in" |
span | #87 | r | #29 | "9 in" |
foot | #87 | r | #29 | "12 in" |
feet | #87 | r | #29 | "foot" |
ft | #87 | r | #29 | "foot" |
cubit | #87 | r | #29 | "18 in" |
pace | #87 | r | #29 | "30 inch" |
yard | #87 | r | #29 | "3 ft" |
yd | #87 | r | #29 | "yard" |
fathom | #87 | r | #29 | "6 ft" |
rod | #87 | r | #29 | "16.5 ft" |
rd | #87 | r | #29 | "rod" |
rope | #87 | r | #29 | "20 ft" |
ell | #87 | r | #29 | "45 in" |
skein | #87 | r | #29 | "360 feet" |
cable | #87 | r | #29 | "720 ft" |
furlong | #87 | r | #29 | "660 ft" |
nmile | #87 | r | #29 | "1852 m" |
nautmile | #87 | r | #29 | "nmile" |
bolt | #87 | r | #29 | "120 feet" |
mile | #87 | r | #29 | "5280 feet" |
mi | #87 | r | #29 | "mile" |
league | #87 | r | #29 | "3 mi" |
nautleague | #87 | r | #29 | "3 nmile" |
lightyear | #87 | r | #29 | "c yr" |
engineerschain | #87 | r | #29 | "100 ft" |
engineerslink | #87 | r | #29 | "0.01 engineerschain" |
gunterchain | #87 | r | #29 | "66 ft" |
gunterlink | #87 | r | #29 | "0.01 gunterchain" |
ramdenchain | #87 | r | #29 | "100 ft" |
ramdenlink | #87 | r | #29 | "0.01 ramdenchain" |
acre | #87 | r | #29 | "43560 ft2" |
rood | #87 | r | #29 | "0.25 acre" |
are | #87 | r | #29 | "100 m2" |
centare | #87 | r | #29 | "0.01 are" |
hectare | #87 | r | #29 | "100 are" |
barn | #87 | r | #29 | "1e-24 cm2" |
section | #87 | r | #29 | "mi2" |
township | #87 | r | #29 | "36 mi2" |
cc | #87 | r | #29 | "cm3" |
liter | #87 | r | #29 | "1000 cc" |
l | #87 | r | #29 | "liter" |
ml | #87 | r | #29 | "milliliter" |
registerton | #87 | r | #29 | "100 ft3" |
cord | #87 | r | #29 | "128 ft3" |
boardfoot | #87 | r | #29 | "144 in3" |
boardfeet | #87 | r | #29 | "boardfoot" |
cordfoot | #87 | r | #29 | "0.125 cord" |
cordfeet | #87 | r | #29 | "cordfoot" |
last | #87 | r | #29 | "80 bu" |
perch | #87 | r | #29 | "24.75 ft3" |
stere | #87 | r | #29 | "m3" |
cfs | #87 | r | #29 | "ft3/sec" |
gallon | #87 | r | #29 | "231 in3" |
imperial | #87 | r | #29 | "1.200949" |
gal | #87 | r | #29 | "gallon" |
quart | #87 | r | #29 | "1|4 gal" |
qt | #87 | r | #29 | "quart" |
magnum | #87 | r | #29 | "2 qt" |
pint | #87 | r | #29 | "1|2 qt" |
pt | #87 | r | #29 | "pint" |
cup | #87 | r | #29 | "1|2 pt" |
gill | #87 | r | #29 | "1|4 pt" |
fifth | #87 | r | #29 | "1|5 gal" |
firkin | #87 | r | #29 | "72 pint" |
barrel | #87 | r | #29 | "31.5 gal" |
petrbarrel | #87 | r | #29 | "42 gal" |
hogshead | #87 | r | #29 | "63 gal" |
hd | #87 | r | #29 | "hogshead" |
tun | #87 | r | #29 | "252 gal" |
kilderkin | #87 | r | #29 | "18 imperial gal" |
noggin | #87 | r | #29 | "1 imperial gill" |
floz | #87 | r | #29 | "1|4 gill" |
fldr | #87 | r | #29 | "1|32 gill" |
tablespoon | #87 | r | #29 | "4 fldr" |
teaspoon | #87 | r | #29 | "1|3 tablespoon" |
minim | #87 | r | #29 | "1|480 floz" |
pk | #87 | r | #29 | "peck" |
bushel | #87 | r | #29 | "8 dry gal" |
dry | #87 | r | #29 | "268.8025 in3/gallon" |
bu | #87 | r | #29 | "bushel" |
british | #87 | r | #29 | "277.4193|231" |
brbucket | #87 | r | #29 | "4 dry british gal" |
brpeck | #87 | r | #29 | "2 dry british gal" |
brbushel | #87 | r | #29 | "8 dry british gal" |
brfirkin | #87 | r | #29 | "1.125 brbushel" |
dryquartern | #87 | r | #29 | "2.272980 l" |
liqquarten | #87 | r | #29 | "0.1420613 l" |
butt | #87 | r | #29 | "126 gal" |
bag | #87 | r | #29 | "3 brbushels" |
brbarrel | #87 | r | #29 | "4.5 brbushels" |
seam | #87 | r | #29 | "8 brbushels" |
drachm | #87 | r | #29 | "3.551531 ml" |
newton | #87 | r | #29 | "kg m/sec2" |
pascal | #87 | r | #29 | "nt/m2" |
nt | #87 | r | #29 | "newton" |
joule | #87 | r | #29 | "nt m" |
cal | #87 | r | #29 | "4.1868 joule" |
gramcalorie | #87 | r | #29 | "cal" |
calorie | #87 | r | #29 | "cal" |
btu | #87 | r | #29 | "1054.35 joule" |
frigorie | #87 | r | #29 | "kilocal" |
kcal | #87 | r | #29 | "kilocal" |
kcalorie | #87 | r | #29 | "kilocal" |
langley | #87 | r | #29 | "cal/cm cm" |
dyne | #87 | r | #29 | "erg/cm" |
poundal | #87 | r | #29 | "ft lb/sec2" |
pdl | #87 | r | #29 | "poundal" |
erg | #87 | r | #29 | "1e-7 joule" |
horsepower | #87 | r | #29 | "550 ft lb g/sec" |
hp | #87 | r | #29 | "horsepower" |
poise | #87 | r | #29 | "gram/cm sec" |
reyn | #87 | r | #29 | "6.89476e-6 centipoise" |
rhe | #87 | r | #29 | "1/poise" |
coul | #87 | r | #29 | "coulomb" |
statcoul | #87 | r | #29 | "3.335635e-10 coul" |
ampere | #87 | r | #29 | "coul/sec" |
abampere | #87 | r | #29 | "10 amp" |
amp | #87 | r | #29 | "ampere" |
watt | #87 | r | #29 | "joule/sec" |
volt | #87 | r | #29 | "watt/amp" |
v | #87 | r | #29 | "volt" |
abvolt | #87 | r | #29 | "10 volt" |
statvolt | #87 | r | #29 | "299.7930 volt" |
ohm | #87 | r | #29 | "volt/amp" |
abohm | #87 | r | #29 | "10 ohm" |
mho | #87 | r | #29 | "1/ohm" |
abmho | #87 | r | #29 | "10 mho" |
siemens | #87 | r | #29 | "mho" |
farad | #87 | r | #29 | "coul/volt" |
abfarad | #87 | r | #29 | "10 farad" |
statfarad | #87 | r | #29 | "1.112646e-12 farad" |
pf | #87 | r | #29 | "picofarad" |
abhenry | #87 | r | #29 | "10 henry" |
henry | #87 | r | #29 | "sec2/farad" |
stathenry | #87 | r | #29 | "8.987584e11 henry" |
mh | #87 | r | #29 | "millihenry" |
weber | #87 | r | #29 | "volt sec" |
gauss | #87 | r | #29 | "maxwell/cm2" |
electronvolt | #87 | r | #29 | "e volt" |
ev | #87 | r | #29 | "e volt" |
kev | #87 | r | #29 | "1e3 ev" |
mev | #87 | r | #29 | "1e6 ev" |
bev | #87 | r | #29 | "1e9 ev" |
faraday | #87 | r | #29 | "9.648456e4coul" |
gilbert | #87 | r | #29 | "0.7957747154 amp" |
oersted | #87 | r | #29 | "1 gilbert / cm" |
oe | #87 | r | #29 | "oersted" |
cd | #87 | r | #29 | "candela" |
lumen | #87 | r | #29 | "cd sr" |
lux | #87 | r | #29 | "lumen/m2" |
footcandle | #87 | r | #29 | "lumen/ft2" |
footlambert | #87 | r | #29 | "cd/pi ft2" |
lambert | #87 | r | #29 | "cd/pi cm2" |
phot | #87 | r | #29 | "lumen/cm2" |
stilb | #87 | r | #29 | "cd/cm2" |
candle | #87 | r | #29 | "cd" |
engcandle | #87 | r | #29 | "1.04 cd" |
germancandle | #87 | r | #29 | "1.05 cd" |
carcel | #87 | r | #29 | "9.61 cd" |
hefnerunit | #87 | r | #29 | ".92 cd" |
candlepower | #87 | r | #29 | "12.566370 lumen" |
baud | #87 | r | #29 | "bit/sec" |
byte | #87 | r | #29 | "8 bit" |
kb | #87 | r | #29 | "1024 byte" |
mb | #87 | r | #29 | "1024 kb" |
gb | #87 | r | #29 | "1024 mb" |
word | #87 | r | #29 | "4 byte" |
long | #87 | r | #29 | "4 word" |
block | #87 | r | #29 | "512 byte" |
mph | #87 | r | #29 | "mile/hr" |
knot | #87 | r | #29 | "nmile/hr" |
brknot | #87 | r | #29 | "6080 ft/hr" |
mach | #87 | r | #29 | "331.45 m/sec" |
energy | #87 | r | #29 | "c2" |
ccs | #87 | r | #29 | "1|36 erlang" |
peck | #87 | r | #29 | "2 dry gallon" |
arpentcan | #87 | r | #29 | "27.52 mi" |
apostilb | #87 | r | #29 | "cd/pi m2" |
arpentlin | #87 | r | #29 | "191.835 ft" |
astonomicalunit | #87 | r | #29 | "au" |
atomicmassunit | #87 | r | #29 | "amu" |
barie | #87 | r | #29 | "1e-1 nt/m2" |
barye | #87 | r | #29 | "1e-1 nt/m2" |
biot | #87 | r | #29 | "10 amp" |
blondel | #87 | r | #29 | "cd/pi m2" |
bottommeasure | #87 | r | #29 | "1|40 in" |
refrigeration | #87 | r | #29 | "12000 but/ton hr" |
centesimalminute | #87 | r | #29 | "1e-2 grade" |
centesimalsecond | #87 | r | #29 | "1e-4 grade" |
chain | #87 | r | #29 | "gunterchain" |
circularinch | #87 | r | #29 | "1|4 pi in2" |
circularmil | #87 | r | #29 | "1e-6|4 pi in2" |
clusec | #87 | r | #29 | "1e-8 mm hg m3/s" |
coomb | #87 | r | #29 | "4 bu" |
crith | #87 | r | #29 | "9.06e-2 gram" |
dioptre | #87 | r | #29 | "1/m" |
displacementton | #87 | r | #29 | "35 ft3" |
dopplezentner | #87 | r | #29 | "100 kg" |
equivalentfootcandle | #87 | r | #29 | "lumen/pi ft2" |
equivalentlux | #87 | r | #29 | "lumen/pi m2" |
equivalentphot | #87 | r | #29 | "cd/pi cm2" |
finger | #87 | r | #29 | "7|8 in" |
franklin | #87 | r | #29 | "3.33564e-10 coul" |
galileo | #87 | r | #29 | "1e-2 m/sec2" |
geographicalmile | #87 | r | #29 | "nmile" |
hefnercandle | #87 | r | #29 | "hefnerunit" |
homestead | #87 | r | #29 | "1|4 mi2" |
hyl | #87 | r | #29 | "gram force sec2/m" |
imaginarycubicfoot | #87 | r | #29 | "1.4 ft3" |
jeroboam | #87 | r | #29 | "4|5 gal" |
line | #87 | r | #29 | "1|12 in" |
link | #87 | r | #29 | "66|100 ft" |
lusec | #87 | r | #29 | "1e-6 mm hg m3/s" |
marineleague | #87 | r | #29 | "3nmile" |
maxwell | #87 | r | #29 | "1e-8 weber" |
mgd | #87 | r | #29 | "megagal/day" |
minersinch | #87 | r | #29 | "1.5 ft3/min" |
nail | #87 | r | #29 | "1|16 yd" |
nit | #87 | r | #29 | "cd/m2" |
nox | #87 | r | #29 | "1e-3 lux" |
pieze | #87 | r | #29 | "1e3 nt/mt2" |
pipe | #87 | r | #29 | "4 barrel" |
pole | #87 | r | #29 | "rd" |
quarter | #87 | r | #29 | "9 in" |
quartersection | #87 | r | #29 | "1|4 mi2" |
ra | #87 | r | #29 | "100 erg/gram" |
rankine | #87 | r | #29 | "1.8 kelvin" |
rehoboam | #87 | r | #29 | "156 floz" |
rontgen | #87 | r | #29 | "2.58e-4 curie/kg" |
rydberg | #87 | r | #29 | "1.36054e1 ev" |
sabin | #87 | r | #29 | "1 ft2" |
shippington | #87 | r | #29 | "40 ft3" |
sigma | #87 | r | #29 | "microsec" |
skot | #87 | r | #29 | "1e-3 apostilb" |
spat | #87 | r | #29 | "sphere" |
spindle | #87 | r | #29 | "14400 yd" |
square | #87 | r | #29 | "100 ft2" |
sthene | #87 | r | #29 | "1e3 nt" |
tesla | #87 | r | #29 | "weber/m2" |
thermie | #87 | r | #29 | "1e6 cal" |
timberfoot | #87 | r | #29 | "ft3" |
tonne | #87 | r | #29 | "1e6 gram" |
water | #87 | r | #29 | "0.22491|2.54 kg/m2 sec2" |
xunit | #87 | r | #29 | "1.00202e-13 m" |
k | #87 | r | #29 | "1.38047e-16 erg/kelvin" |
puncheon | #87 | r | #29 | "84 gal" |
tnt | #87 | r | #29 | "4.6e6 m2/sec2" |
basic_units_template | #87 | r | #29 | list of 9{{"m", 0}, {"kg", 0}, {"s", 0}, {"coul", 0}, {"candela", 0}, {"radian", 0}, {"bit", 0}, {"erlang", 0}, {"kelvin", 0}} |
meter | #87 | r | #29 | "m" |
gram | #87 | r | #29 | "1|1000 kg" |
second | #87 | r | #29 | "s" |
inches | #87 | r | #29 | "inch" |
sennight | #87 | r | #29 | "1 week" |
help_msg | #72 | rc | #29 | list of 20{"Utility verbs for converting from one unit of measure to another.", "", "Unusual conversions:", ":dd_to_dms => converts decimal (INT or FLOAT) Degrees into Degrees, Minutes,", " and Seconds. (Also works for decimal Hours.)", ":dms_to_dd => converts from Degrees (or Hours), Minutes, and Seconds to", " decimal Degrees (or Hours).", ":rect_to_polar => converts from cartesian (x,y) coordinates to polar.", ":polar_to_rect => converts from polar (r, theta) coordinates to cartesian.", ":F_to_C => converts from Fahrenheit to Celsius.", ":C_to_F => converts from Celsius to Fahrenheit.", ":C_to_K => converts from Celsius to Kelvin.", ":K_to_C => converts from Kelvin to Celsius.", ":F_to_R => converts from Fahrenheit to Rankine.", ":R_to_F => converts from Rankine to Fahrenheit.", "", "Standard conversions:", ":convert => takes two string inputs and attempts to determine the ", " multiplicative conversion factor. See the verb help for details", " and input format.\""} |
aliases | #1 | rc | #29 | {"Conversion Utils"} |
description | #1 | rc | #29 | "This is a utilities package for converting from one unit of measurement to another. Type 'help #770' for more details." |
object_size | #1 | r | #29 | {30928, 1298433815} |
hidden_verbs | #1 | rc | #29 | <clear> |
phelp_msg | #1 | rc | #29 | <clear> |
weight | #1 | rc | #29 | <clear> |
owner_verbs | #1 | rc | #29 | <clear> |
plural_name | #1 | rc | #29 | <clear> |
client_image | #1 | rc | #29 | <clear> |
listening | #1 | rc | #29 | <clear> |
Ancestry
Ancestors (nearest first): #72 Generic Utilities Package → #1 root
Children: none
Call graph
Source
dd_to_dms dh_to_hms
Referenced by
none
Source
1":dd_to_dms(INT|FLOAT <degrees>) => LIST {INT <degrees>, INT <minutes>, FLOAT <seconds>}"; 2"This verb converts decimal degrees to degrees, minutes, and seconds."; 3dd = tofloat(args[1]); 4s = (((dd - tofloat(d = toint(dd))) * 60.0) - tofloat(m = toint((dd - tofloat(d)) * 60.0))) * 60.0; 5return {d, m, s};
dms_to_dd hms_to_dh
Referenced by
none
Source
1":dms_to_dd(INT|FLOAT <deg>, INT|FLOAT <min>, INT|FLOAT <sec>) => FLOAT <deg>"; 2"This verb converts degrees/minutes/seconds to decimal degrees."; 3{d, m, s} = args[1..3]; 4d = tofloat(d); 5m = tofloat(m); 6s = tofloat(s); 7return (d + (m / 60.0)) + (s / 3600.0);
rect_to_polar
Referenced by
none
Source
1":rect_to_polar(INT|FLOAT <x>, INT|FLOAT <y>) => FLOAT <radius>, FLOAT <angle>."; 2"This verb converts from rectangular (x,y) coordinates to polar (r, theta) coordinates."; 3{x, y} = args[1..2]; 4x = tofloat(x); 5y = tofloat(y); 6return {sqrt((x * x) + (x * x)), `atan(y, x) ! E_INVARG => 0.0'};
polar_to_rect
Referenced by
none
Source
1":polar_to_rect(INT|FLOAT <radius>, INT|FLOAT <angle>) => FLOAT <x>, FLOAT <y>"; 2"This verb converts from polar (radius, angle) coordinates to rectangulat (x,y) coordinates."; 3{r, a} = args[1..2]; 4r = tofloat(r); 5a = tofloat(a); 6return {(r = r / (1.0 + (z2 = (z = tan(a / 2.0)) * z))) * (1.0 - z2), (r * 2.0) * z};
F_to_C degF_to_degC
Referenced by
none
Source
1":F_to_C(INT|FLOAT <Fahrenheit>) => FLOAT <Celsius>"; 2"This verb converts Fahrenheit degrees to Celsius degrees."; 3return (tofloat(args[1]) - 32.0) / 1.8;
C_to_F degC_to_degF
Referenced by
none
Source
1":C_to_F(INT|FLOAT <Celsius>) => FLOAT <Fahrenheit>"; 2"This verb converts Celsius degrees to Fahrenheit degrees."; 3return (tofloat(args[1]) * 1.8) + 32.0;
convert
Referenced by
none
Source
1":convert(STR <units>, STR <units>) => FLOAT conversion factor | LIST errors."; 2"This verb attempts to compute the conversion factor between two sets of units. If the two inputs are of the same type (two speeds, two lengths, etc.), the value is returned. If the two inputs are not of the same type, a LIST is returned as follows: {1, {FLOAT <value>, STR <units>}. {FLOAT <value>, STR <units>}}. The 1 indicates that the two inputs were correctly formed. <value> is the conversion factor of the input into the basic <units>. This error output is useful for determining the basic structure and value of an unknown unit of measure. If either of the inputs can not be broken down to known units, a LIST is returned as follows: {0, STR <bad input>}."; 3""; 4"The format of the input strings is fairly straight forward: any multiplicative combination of units, ending in an optional digit to represent that unit is raised to a power, the whole of which is preceeded by an initial value. Examples: \"100 kg m/sec2\", \"35 joules\", \"2000 furlongs/fortnight\""; 5""; 6"Some example uses:"; 7";$convert_utils:convert(\"2000 furlongs/fortnight\", \"mph\")"; 8"=> 0.744047619047619"; 9";$convert_utils:convert(\"kilowatt hours\", \"joules\")"; 10"=> 3600000.0"; 11""; 12";$convert_utils:convert(\"furlongs\", \"mph\")"; 13"=> {1, {201.168, \"m\"}, {044704, \"m / s\"}}"; 14""; 15";$convert_utils:convert(\"junk\", \"meters\")"; 16"=> {0, \"junk\"}"; 17{havestr, wantstr} = args; 18have = this:_do_convert(havestr); 19want = this:_do_convert(wantstr); 20if ((have && want) && (have[2] == want[2])) 21return have[1] / want[1]; 22elseif (have && want) 23return {1, {have[1], this:_format_units(@have[2])}, {want[1], this:_format_units(@want[2])}}; 24else 25return {0, have ? wantstr | havestr}; 26endif
_do_convert
Referenced by
- #87:convert line 18:
this:_do_convert - #87:convert line 19:
this:_do_convert - #87:_do_convert line 44:
this:_do_convert - #87:_do_convert line 57:
this:_do_convert
Source
1"THIS VERB IS NOT INTENDED FOR USER USAGE."; 2":_do_convert is the workhorse of $convert_utils:convert and is based loosely upon the 'units' Perl script the ships with BSD Unix."; 3"Essentially, it breaks the input up into values and units, attempts to break each unit down into elementary (basic) units, modifies the value as it goes, until it has no more input or can not convert a unit into a basic unit."; 4instr = args[1]; 5units = this.basic_units_template; 6value = 1.0; 7top = 1; 8"Ensure that the division mark is a spearate word."; 9instr = $string_utils:substitute(instr, {{"/", " / "}}); 10while (instr) 11"Grab the next word to process"; 12{first, instr} = $string_utils:first_word(instr); 13if (first == "/") 14"Now we're working with values under the division mark - units with negative exponents."; 15top = 1 - top; 16continue; 17elseif (match(first, "|")) 18"The word was a value expressed as a ratio. Compute the ratio and adjust the value accordingly."; 19value = this:_do_value(first, value, top); 20continue; 21elseif ($string_utils:is_integer(first) || $string_utils:is_float(first)) 22"The word was a value. Adjust the accumulated value accordingly."; 23value = top ? value * tofloat(first) | (value / tofloat(first)); 24continue; 25elseif (match(first, "[0-9]$")) 26"The word ends with a digit, but isn't a value. It must be a powered unit. Expand it: cm3 => cm cm cm"; 27subs = match(first, "%([a-zA-Z]+%)%([0-9]+%)"); 28first = substitute("%1", subs); 29power = toint(substitute("%2", subs)); 30while (power > 0) 31instr = (first + " ") + instr; 32power = power - 1; 33endwhile 34continue; 35else 36"Check to see if the word starts with one or more metric prefix and attempt to evaluate the prefix."; 37{first, value, top} = this:_try_metric_prefix(first, value, top); 38"Check to see if we have a basic unit. If so, adjust the apropriate unit count."; 39if (index = first in this.basic_units) 40units[index][2] = top ? units[index][2] + 1 | (units[index][2] - 1); 41continue; 42elseif (prop = `this.(first) ! E_PROPNF => 0') 43"Check to see if this is a known unit. If so, convert it and adjust the value and units."; 44result = this:_do_convert(prop); 45value = top ? value * result[1] | (value / result[1]); 46for i in [1..length(units)] 47units[i][2] = top ? units[i][2] + result[2][i][2] | (units[i][2] - result[2][i][2]); 48endfor 49continue; 50elseif (first[$] == "s") 51"Check to see if this is a normal 's'-ending plural, and try to do the above checks again."; 52temp = first[1..$ - 1]; 53if (index = temp in this.basic_units) 54units[index][2] = top ? units[index][2] + 1 | (units[index][2] - 1); 55continue; 56elseif (prop = `this.(temp) ! E_PROPNF => 0') 57result = this:_do_convert(prop); 58value = top ? value * result[1] | (value / result[1]); 59for i in [1..length(units)] 60units[i][2] = top ? units[i][2] + result[2][i][2] | (units[i][2] - result[2][i][2]); 61endfor 62continue; 63endif 64endif 65"We were unable to find any conversion for the current word, so halt all operation and return 0."; 66return 0; 67endif 68endwhile 69"We were able to successfully convert each part of the input. Return the equivalent value and units."; 70return {value, units};
_try_metric_prefix
Referenced by
- #87:_do_convert line 37:
this:_try_metric_prefix
Source
1"THIS VERB IS NOT INTENDED FOR USER USAGE."; 2":_try_metric_prefix runs through the metrix multipliers and tries to match them against the beginning of the input string. If successful, the given value is adjusted appropritately, and the input string is modified. The verb loops until there are no more prefix matches. (Hence, \"kilodecameter\" can be matched with only one verb call."; 3"If anyone knows of other possibilities here, please let me know."; 4{first, value, top} = args; 5while (1) 6if (subs = match(first, "^yocto%(.*%)")) 7first = substitute("%1", subs); 8value = top ? value / 1e+24 | (value * 1e+24); 9continue; 10endif 11if (subs = match(first, "^zepto%(.*%)")) 12first = substitute("%1", subs); 13value = top ? value / 1e+21 | (value * 1e+21); 14continue; 15endif 16if (subs = match(first, "^atto%(.*%)")) 17first = substitute("%1", subs); 18value = top ? value / 1e+18 | (value * 1e+18); 19continue; 20endif 21if (subs = match(first, "^femto%(.*%)")) 22first = substitute("%1", subs); 23value = top ? value / 1e+15 | (value * 1e+15); 24continue; 25endif 26if (subs = match(first, "^pico%(.*%)")) 27first = substitute("%1", subs); 28value = top ? value / 1000000000000.0 | (value * 1000000000000.0); 29continue; 30endif 31if (subs = match(first, "^nano%(.*%)")) 32first = substitute("%1", subs); 33value = top ? value / 1000000000.0 | (value * 1000000000.0); 34continue; 35endif 36if (match(first, "^micron")) 37break; 38endif 39if (subs = match(first, "^micro%(.*%)")) 40first = substitute("%1", subs); 41value = top ? value / 1000000.0 | (value * 1000000.0); 42continue; 43endif 44if (subs = match(first, "^milli%(.*%)")) 45first = substitute("%1", subs); 46value = top ? value / 1000.0 | (value * 1000.0); 47continue; 48endif 49if (subs = match(first, "^centi%(.*%)")) 50first = substitute("%1", subs); 51value = top ? value / 100.0 | (value * 100.0); 52continue; 53endif 54if (subs = match(first, "^deci%(.*%)")) 55first = substitute("%1", subs); 56value = top ? value / 10.0 | (value * 10.0); 57continue; 58endif 59if (subs = match(first, "^%(deca%|deka%)%(.*%)")) 60first = substitute("%2", subs); 61value = (!top) ? value / 10.0 | (value * 10.0); 62continue; 63endif 64if (subs = match(first, "^hecto%(.*%)")) 65first = substitute("%1", subs); 66value = (!top) ? value / 100.0 | (value * 100.0); 67continue; 68endif 69if (subs = match(first, "^kilo%(.*%)")) 70first = substitute("%1", subs); 71value = (!top) ? value / 1000.0 | (value * 1000.0); 72continue; 73endif 74if (subs = match(first, "^mega%(.*%)")) 75first = substitute("%1", subs); 76value = (!top) ? value / 1000000.0 | (value * 1000000.0); 77continue; 78endif 79if (subs = match(first, "^giga%(.*%)")) 80first = substitute("%1", subs); 81value = (!top) ? value / 1000000000.0 | (value * 1000000000.0); 82continue; 83endif 84if (subs = match(first, "^tera%(.*%)")) 85first = substitute("%1", subs); 86value = (!top) ? value / 1000000000000.0 | (value * 1000000000000.0); 87continue; 88endif 89if (subs = match(first, "^peta%(.*%)")) 90first = substitute("%1", subs); 91value = (!top) ? value / 1e+15 | (value * 1e+15); 92continue; 93endif 94if (subs = match(first, "^exa%(.*%)")) 95first = substitute("%1", subs); 96value = (!top) ? value / 1e+18 | (value * 1e+18); 97continue; 98endif 99if (subs = match(first, "^zetta%(.*%)")) 100first = substitute("%1", subs); 101value = (!top) ? value / 1e+21 | (value * 1e+21); 102continue; 103endif 104if (subs = match(first, "^yotta%(.*%)")) 105first = substitute("%1", subs); 106value = (!top) ? value / 1e+24 | (value * 1e+24); 107continue; 108endif 109break; 110endwhile 111return {first, value, top};
_format_units
Referenced by
- #87:convert line 23:
this:_format_units - #87:convert line 23:
this:_format_units
Source
1"THIS VERB IS NOT INTENDED FOR USER USAGE."; 2":_format_units takes the associative list of units and powers and construct a more user friendly string."; 3top = bottom = ""; 4for pair in (args) 5if (pair[2] > 0) 6top = tostr(top, " ", pair[1], (pair[2] > 1) ? pair[2] | ""); 7elseif (pair[2] < 0) 8bottom = tostr(bottom, " ", pair[1], (pair[2] < -1) ? -pair[2] | ""); 9endif 10endfor 11if (bottom) 12return ((top + " /") + bottom)[2..$]; 13else 14return top[2..$]; 15endif
K_to_C degK_to_degC
Referenced by
none
Source
1":K_to_C (INT|FLOAT <Kelvin>) => FLOAT <Celcius>"; 2"This verb converts Kelvin degrees to Celcius degrees."; 3return tofloat(args[1]) - 273.0;
C_to_K degC_to_degK
Referenced by
none
Source
1":C_to_K (INT|FLOAT <Celcius>) => FLOAT <Kelvin>"; 2"This verb converts Celcius degrees to Kelvin degrees."; 3return tofloat(args[1]) + 273.0;
F_to_R degF_to_degR
Referenced by
none
Source
1":F_to_R (INT|FLOAT <Fahrenheit>) => FLOAT <Rankine>"; 2"This verb converts Fahrenheit degrees to Rankine degrees."; 3return tofloat(args[1]) + 491.4;
R_to_F degR_to_degF
Referenced by
none
Source
1":R_to_F (INT|FLOAT <Rankine>) => FLOAT <Fahrenheit>"; 2"This verb converts Rankine degrees to Fahrenheit degrees."; 3return tofloat(args[1]) - 491.4;
_do_value
Referenced by
- #87:_do_convert line 19:
this:_do_value
Source
1"THIS VERB IS NOT INTENDED FOR USER USAGE."; 2":_do_value takes a string of the form <number>|<number>, interprets it as a ratio, and applies that ratio to the incoming 'value' accordingly with the 'top' input, and returns it back to the calling verb."; 3{first, value, top} = args; 4{numer, denom} = $string_utils:explode(first, "|"); 5return top ? (value * tofloat(numer)) / tofloat(denom) | ((value * tofloat(denom)) / tofloat(numer));