]> gitweb.factorcode.org Git - factor.git/commitdiff
math.functions: make it clear that 0 = is the more correct zero?.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Aug 2012 15:03:54 +0000 (08:03 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 13 Aug 2012 15:03:54 +0000 (08:03 -0700)
basis/math/complex/complex-tests.factor
basis/math/functions/functions.factor

index 9869d0d593e28bac99a7ef979738079e02bfd179..57a5c8fd278680472849968ae818dccdb719421c 100644 (file)
@@ -16,6 +16,8 @@ IN: math.complex.tests
 [ f ] [ C{ 1.0 2.3 } C{ 1 2 } number= ] unit-test
 
 [ C{ 2 5 } ] [ 2 5  rect> ] unit-test
+{ 2 } [ 2 0  rect> ] unit-test
+{ C{ 2 0.0 } } [ 2 0.0  rect> ] unit-test
 [ 2 5 ] [ C{ 2 5 }  >rect ] unit-test
 [ C{ 1/2 1 } ] [ 1/2 C{ 0 1 }  + ] unit-test
 [ C{ 1/2 1 } ] [ C{ 0 1 } 1/2  + ] unit-test
index c21586f9cc636c908f1ebf1ca76dc3b96d949581..264a15d7b06b6ff94fd2dd6555a58da1ea17705a 100644 (file)
@@ -8,6 +8,7 @@ IN: math.functions
     [ numerator ] [ denominator ] bi ; inline
 
 : rect> ( x y -- z )
+    ! Note: an imaginary 0.0 should still create a complex
     dup 0 = [ drop ] [ complex boa ] if ; inline
 
 GENERIC: sqrt ( x -- y ) foldable