]> gitweb.factorcode.org Git - factor.git/commitdiff
decimals: rename D: to DECIMAL: to help with new parser until we figure out how best...
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 14 Aug 2015 22:04:53 +0000 (15:04 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 14 Aug 2015 22:04:53 +0000 (15:04 -0700)
extra/benchmark/e-decimals/e-decimals.factor
extra/decimals/decimals-tests.factor
extra/decimals/decimals.factor

index 1328bc20fa8561f4c65ef011a744b78a9e45b670..4da5cff828b91d499574e2c00fd0af8e123947c4 100644 (file)
@@ -5,11 +5,11 @@ sequences ;
 IN: benchmark.e-decimals
 
 : D-factorial ( n -- D! )
-    iota D: 1 [ 0 <decimal> D: 1 D+ D* ] reduce ; inline
+    iota DECIMAL: 1 [ 0 <decimal> DECIMAL: 1 D+ D* ] reduce ; inline
 
 :: calculate-e-decimals ( n -- e )
-    n [1,b] D: 1
-    [ D-factorial D: 1 swap n D/ D+ ] reduce ;
+    n [1,b] DECIMAL: 1
+    [ D-factorial DECIMAL: 1 swap n D/ D+ ] reduce ;
 
 : e-decimals-benchmark ( -- )
     5 [ 800 calculate-e-decimals drop ] times ;
index 726212b0ea76afa5b43508dc00b803d8746dafc1..3b09d3b19d657836e2b4a92b8eb37c6f96cd6af5 100644 (file)
@@ -6,7 +6,7 @@ sequences tools.test kernel.private ;
 IN: decimals.tests
 
 { t } [
-    D: 12.34 D: 00012.34000 =
+    DECIMAL: 12.34 DECIMAL: 00012.34000 =
 ] unit-test
 
 : random-test-int ( -- n )
@@ -38,15 +38,15 @@ ERROR: decimal-test-failure D1 D2 quot ;
 ] unit-test
 
 { t } [
-    { D: 0. D: .0 D: 0.0 D: 00.00 D: . } all-equal?
+    { DECIMAL: 0. DECIMAL: .0 DECIMAL: 0.0 DECIMAL: 00.00 DECIMAL: . } all-equal?
 ] unit-test
 
 { t } [ T{ decimal f 90 0 } T{ decimal f 9 1 } = ] unit-test
 
-{ t } [ D: 1 D: 2 before? ] unit-test
-{ f } [ D: 2 D: 2 before? ] unit-test
-{ f } [ D: 3 D: 2 before? ] unit-test
-{ f } [ D: -1 D: -2 before? ] unit-test
-{ f } [ D: -2 D: -2 before? ] unit-test
-{ t } [ D: -3 D: -2 before? ] unit-test
-{ t } [ D: .5 D: 0 D: 1.0 between? ] unit-test
+{ t } [ DECIMAL: 1 DECIMAL: 2 before? ] unit-test
+{ f } [ DECIMAL: 2 DECIMAL: 2 before? ] unit-test
+{ f } [ DECIMAL: 3 DECIMAL: 2 before? ] unit-test
+{ f } [ DECIMAL: -1 DECIMAL: -2 before? ] unit-test
+{ f } [ DECIMAL: -2 DECIMAL: -2 before? ] unit-test
+{ t } [ DECIMAL: -3 DECIMAL: -2 before? ] unit-test
+{ t } [ DECIMAL: .5 DECIMAL: 0 DECIMAL: 1.0 between? ] unit-test
index 1d244f0355a29f1f6dbae0188b9aface42a05eb1..05fb11b411e4d973e8e76eec1dc95ca71db70d4a 100644 (file)
@@ -20,7 +20,7 @@ TUPLE: decimal { mantissa read-only } { exponent read-only } ;
 
 : parse-decimal ( -- decimal ) scan-token string>decimal ;
 
-SYNTAX: D: parse-decimal suffix! ;
+SYNTAX: DECIMAL: parse-decimal suffix! ;
 
 : decimal>ratio ( decimal -- ratio ) >decimal< 10^ * ;
 : decimal>float ( decimal -- ratio ) decimal>ratio >float ;