diff --git a/basis/math/complex/complex-tests.factor b/basis/math/complex/complex-tests.factor index 9869d0d593..57a5c8fd27 100644 --- a/basis/math/complex/complex-tests.factor +++ b/basis/math/complex/complex-tests.factor @@ -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 diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index c21586f9cc..264a15d7b0 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -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