]> gitweb.factorcode.org Git - factor.git/commitdiff
math.vectors.simd: fix bad comparison logic in unit tests
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 30 Sep 2009 04:46:21 +0000 (23:46 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 30 Sep 2009 04:46:21 +0000 (23:46 -0500)
basis/math/vectors/simd/simd-tests.factor

index 83d29ac3083b8d2135c392abddd3e9303ef66649..ce17736d75b6949caee634d304c644e675676638 100644 (file)
@@ -177,21 +177,29 @@ CONSTANT: simd-classes
 : approx= ( x y -- ? )
     {
         { [ 2dup [ float? ] both? ] [ -1.e8 ~ ] }
+        { [ 2dup [ fp-infinity? ] either? ] [ fp-bitwise= ] }
         { [ 2dup [ sequence? ] both? ] [
             [
                 {
                     { [ 2dup [ fp-nan? ] both? ] [ 2drop t ] }
+                    { [ 2dup [ fp-infinity? ] either? ] [ fp-bitwise= ] }
                     { [ 2dup [ fp-nan? ] either? not ] [ -1.e8 ~ ] }
                 } cond
             ] 2all?
         ] }
     } cond ;
 
+: exact= ( x y -- ? )
+    {
+        { [ 2dup [ float? ] both? ] [ fp-bitwise= ] }
+        { [ 2dup [ sequence? ] both? ] [ [ fp-bitwise= ] 2all? ] }
+    } cond ;
+
 : simd-classes&reps ( -- alist )
     simd-classes [
         {
             { [ dup name>> "float" head? ] [ float [ approx= ] ] }
-            { [ dup name>> "double" head? ] [ float [ = ] ] }
+            { [ dup name>> "double" head? ] [ float [ exact= ] ] }
             [ fixnum [ = ] ]
         } cond 3array
     ] map ;