factor/extra/units/imperial/imperial.factor

189 lines
4.5 KiB
Factor
Raw Permalink Normal View History

2007-09-20 18:09:08 -04:00
USING: kernel math prettyprint units units.si inverse ;
IN: units.imperial
! TEMPERATURE
: deg-F ( n -- Fahrenheit ) 32 - 5/9 * deg-C ;
ALIAS: <EFBFBD>F deg-F
2013-05-21 13:38:54 -04:00
! LENGTH
2007-09-20 18:09:08 -04:00
: inches ( n -- dimensioned ) 254/100 * cm ;
2013-05-21 13:38:54 -04:00
: thous ( n -- dimensioned ) 1/1000 * inches ;
2007-09-20 18:09:08 -04:00
: feet ( n -- dimensioned ) 12 * inches ;
: yards ( n -- dimensioned ) 3 * feet ;
2013-05-21 13:38:54 -04:00
: miles ( n -- dimensioned ) 1760 * yards ;
: furlongs ( n -- dimensioned ) 1/8 * miles ;
: chains ( n -- dimensioned ) 1/10 * furlongs ;
: leagues ( n -- dimensioned ) 3 * miles ;
: links ( n -- dimensioned ) 1/100 * chains ;
: rods ( n -- dimensioned ) 5+1/2 * yards ;
: barleycorns ( n -- dimensioned ) 1/3 * inches ;
: poppyseeds ( n -- dimensioned ) 1/4 * barleycorns ;
: lines ( n -- dimensioned ) 1/4 * barleycorns ;
: digits ( n -- dimensioned ) 3/4 * inches ;
: hands ( n -- dimensioned ) 4 * inches ;
: palms ( n -- dimensioned ) 3 * inches ;
2013-05-21 13:38:54 -04:00
: shaftments ( n -- dimensioned ) 6 * inches ;
2013-05-21 13:38:54 -04:00
: nails ( n -- dimensioned ) 1/16 * yards ;
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
: spans ( n -- dimensioned ) 3 * palms ;
2013-05-21 13:38:54 -04:00
: fingers ( n -- dimensioned ) 1/8 * yards ; ! FIXME: or 7/8 * inches?
2013-05-21 13:38:54 -04:00
: cubits ( n -- dimensioned ) 18 * inches ;
2013-05-21 13:38:54 -04:00
: ells ( n -- dimensioned ) 1+1/4 * yards ;
ALIAS: poles rods
ALIAS: perches rods
: ramsdens-chains ( n -- dimensioned ) 100 * feet ;
2007-09-20 18:09:08 -04:00
: nautical-miles ( n -- dimensioned ) 1852 * m ;
: fathoms ( n -- dimensioned ) 6 * feet ;
: shackles ( n -- dimensioned ) 15 * fathoms ;
: cables ( n -- dimensioned ) 608 * feet ;
2013-05-21 13:38:54 -04:00
! VOLUME
DEFER: imperial-fluid-ounces
2013-05-21 15:48:56 -04:00
: minims ( n -- dimensioned ) 1/480 * imperial-fluid-ounces ;
2013-05-21 13:38:54 -04:00
: apothecary-fluid-scruples ( n -- dimensioned ) 20 * minims ;
: apothecary-fluid-drachms ( n -- dimensioned ) 3 * apothecary-fluid-scruples ;
: apothecary-fluid-ounces ( n -- dimensioned ) 8 * apothecary-fluid-drachms ;
: apothecary-pints ( n -- dimensioned ) 20 * apothecary-fluid-ounces ;
: apothecary-gallons ( n -- dimensioned ) 8 * apothecary-pints ;
! MASS
2007-09-20 18:09:08 -04:00
: pounds ( n -- dimensioned ) 22/10 / kg ;
2013-05-21 13:38:54 -04:00
: drachm ( n -- dimensioned ) 1/256 * pounds ;
: grains ( n -- dimensioned ) 1/7000 * pounds ;
2007-09-20 18:09:08 -04:00
: ounces ( n -- dimensioned ) 1/16 * pounds ;
2013-05-21 13:38:54 -04:00
: nailweights ( n -- dimensioned ) 7 * pounds ;
: stones ( n -- dimensioned ) 14 * pounds ;
: tods ( n -- dimensioned ) 2 * stones ;
: hundredweights ( n -- dimensioned ) 112 * pounds ;
: quarters ( n -- dimensioned ) 1/4 * hundredweights ;
: tons ( n -- dimensioned ) 20 * hundredweights ;
2007-09-20 18:09:08 -04:00
: gallons ( n -- dimensioned ) 379/100 * L ;
: quarts ( n -- dimensioned ) 1/4 * gallons ;
: pints ( n -- dimensioned ) 1/2 * quarts ;
: cups ( n -- dimensioned ) 1/2 * pints ;
: us-fluid-ounces ( n -- dimensioned ) 1/16 * pints ;
2013-05-21 13:38:54 -04:00
: drams ( n -- dimensioned ) 1/8 * us-fluid-ounces ;
: teaspoons ( n -- dimensioned ) 1/6 * us-fluid-ounces ;
2007-09-20 18:09:08 -04:00
: tablespoons ( n -- dimensioned ) 1/2 * us-fluid-ounces ;
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
: ponies ( n -- dimensioned ) 3/4 * us-fluid-ounces ;
: jiggers ( n -- dimensioned ) 1+1/2 * us-fluid-ounces ;
: us-gill ( n -- dimensioned ) 4 * us-fluid-ounces ;
2007-09-20 18:09:08 -04:00
: knots ( n -- dimensioned ) 1852/3600 * m/s ;
: imperial-gallons ( n -- dimensioned ) 454609/100000 * L ;
: imperial-quarts ( n -- dimensioned ) 1/4 * imperial-gallons ;
: imperial-pints ( n -- dimensioned ) 1/2 * imperial-quarts ;
: imperial-fluid-ounces ( n -- dimensioned ) 1/160 * imperial-gallons ;
: imperial-gill ( n -- dimensioned ) 5 * imperial-fluid-ounces ;
2013-05-21 13:38:54 -04:00
: dry-gallons ( n -- dimensioned ) 440488377086/100000000000 * L ;
2007-09-20 18:09:08 -04:00
: dry-quarts ( n -- dimensioned ) 1/4 * dry-gallons ;
: dry-pints ( n -- dimensioned ) 1/2 * dry-quarts ;
: pecks ( n -- dimensioned ) 8 * dry-quarts ;
: bushels ( n -- dimensioned ) 4 * pecks ;
2013-05-21 13:38:54 -04:00
: pins ( n -- dimensioned ) 4+1/2 * imperial-gallons ;
: firkins ( n -- dimensioned ) 2 * pins ;
: kilderkins ( n -- dimensioned ) 2 * firkins ;
: beer-barrels ( n -- dimensioned ) 2 * kilderkins ;
: beer-hogsheads ( n -- dimensioned ) 1+1/2 * beer-barrels ;
: beer-butts ( n -- dimensioned ) 2 * beer-hogsheads ;
ALIAS: beer-pipes beer-butts
: beer-tuns ( n -- dimensioned ) 2 * beer-pipes ;
: wine-gallons ( n -- dimensioned ) 18/15 * imperial-gallons ;
: rundlets ( n -- dimensioned ) 18 * wine-gallons ;
: wine-barrels ( n -- dimensioned ) 1+3/4 * rundlets ;
: tierces ( n -- dimensioned ) 1+1/3 * wine-barrels ;
: wine-hogsheads ( n -- dimensioned ) 2 * wine-barrels ;
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
: wine-punchians ( n -- dimensioned ) 2 * tierces ;
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
ALIAS: wine-tertians wine-punchians
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
: wine-butts ( n -- dimensioned ) 2 * wine-hogsheads ;
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
ALIAS: wine-pipes wine-butts
2007-09-20 18:09:08 -04:00
2013-05-21 13:38:54 -04:00
: wine-tun ( n -- dimensioned ) 2 * wine-butts ;