]> gitweb.factorcode.org Git - factor.git/commitdiff
units.imperial: Add area units, choose fingerbreadth, fix encoding
authorGiftpflanze <gifti@tools.wmflabs.org>
Fri, 8 Sep 2023 18:01:15 +0000 (20:01 +0200)
committerGiftpflanze <gifti@tools.wmflabs.org>
Fri, 8 Sep 2023 18:01:27 +0000 (20:01 +0200)
extra/units/imperial/imperial-tests.factor
extra/units/imperial/imperial.factor

index c2e35abdbbf2be544f1e398fb4ad8a3ba5ffedbd..60e656ed3c35e661b9a84b3b8bec54f4d8d1c710 100644 (file)
@@ -31,4 +31,4 @@ USING: kernel math tools.test units.imperial inverse ;
 { 1 } [ 4 inches [ hands ] undo ] unit-test
 { 1 } [ 3 inches [ palms ] undo ] unit-test
 { 1 } [ 16 nails [ yards ] undo ] unit-test
-{ 1 } [ 8 fingers [ yards ] undo ] unit-test
+{ 7 } [ 8 fingers [ inches ] undo ] unit-test
index 856e3a3e2eb548833178f4a867346e850fb2bbd7..e3a8557abea7695c9236239c458d0e6b273618ea 100644 (file)
@@ -1,10 +1,10 @@
-USING: kernel math prettyprint units units.si inverse ;
+USING: math units units.si ;
 IN: units.imperial
 
 ! TEMPERATURE
 
 : deg-F ( n -- Fahrenheit ) 32 - 5/9 * deg-C ;
-ALIAS: °F deg-F
+ALIAS: Â°F deg-F
 
 ! LENGTH
 
@@ -27,6 +27,8 @@ ALIAS: 
 : links ( n -- dimensioned ) 1/100 * chains ;
 
 : rods ( n -- dimensioned ) 5+1/2 * yards ;
+ALIAS: poles rods
+ALIAS: perches rods
 
 : barleycorns ( n -- dimensioned ) 1/3 * inches ;
 
@@ -46,16 +48,12 @@ ALIAS: 
 
 : spans ( n -- dimensioned ) 3 * palms ;
 
-: fingers ( n -- dimensioned ) 1/8 * yards ; ! FIXME: or 7/8 * inches?
+: fingers ( n -- dimensioned ) 7/8 * inches ;
 
 : cubits ( n -- dimensioned ) 18 * inches ;
 
 : ells ( n -- dimensioned ) 1+1/4 * yards ;
 
-ALIAS: poles rods
-
-ALIAS: perches rods
-
 : ramsdens-chains ( n -- dimensioned ) 100 * feet ;
 
 : nautical-miles ( n -- dimensioned ) 1852 * m ;
@@ -66,6 +64,18 @@ ALIAS: perches rods
 
 : cables ( n -- dimensioned ) 608 * feet ;
 
+! AREA
+
+: square-rods ( n -- dimensioned ) 25+1830329/6250000 * m^2 ;
+ALIAS: square-poles square-rods
+ALIAS: square-perches square-rods
+
+: roods ( n -- dimensioned ) 40 * perches ;
+
+: acres ( n -- dimensioned ) 4 * roods ;
+
+: square-miles ( n -- dimensioned ) 640 * acres ;
+
 ! VOLUME
 
 DEFER: imperial-fluid-ounces
@@ -162,7 +172,6 @@ DEFER: imperial-fluid-ounces
 : 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 ;
@@ -178,11 +187,9 @@ ALIAS: beer-pipes beer-butts
 : wine-hogsheads ( n -- dimensioned ) 2 * wine-barrels ;
 
 : wine-punchians ( n -- dimensioned ) 2 * tierces ;
-
 ALIAS: wine-tertians wine-punchians
 
 : wine-butts ( n -- dimensioned ) 2 * wine-hogsheads ;
-
 ALIAS: wine-pipes wine-butts
 
 : wine-tun ( n -- dimensioned ) 2 * wine-butts ;