math.functions: fix ^ for complex numbers

db4
Slava Pestov 2009-05-31 23:28:29 -05:00
parent 0091558ff6
commit e38e805015
2 changed files with 4 additions and 2 deletions

View File

@ -162,3 +162,4 @@ IN: math.functions.tests
[ 2.5 ] [ 1.0 2.5 1.0 lerp ] unit-test
[ 1.75 ] [ 1.0 2.5 0.5 lerp ] unit-test
[ C{ 1 2 } ] [ C{ 1 2 } 1 ^ ] unit-test

View File

@ -34,8 +34,9 @@ M: integer ^n
M: ratio ^n
[ >fraction ] dip [ ^n ] curry bi@ / ;
M: float ^n
(^n) ;
M: float ^n (^n) ;
M: complex ^n (^n) ;
: integer^ ( x y -- z )
dup 0 > [ ^n ] [ neg ^n recip ] if ; inline