From: John Benediktsson Date: Wed, 7 Feb 2024 05:14:30 +0000 (-0800) Subject: math.functions: change { float integer } ^ to use fpow X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=c4b59678928938a93d854bd691f0f1df7e71dcc3 math.functions: change { float integer } ^ to use fpow --- diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index d691fb9f74..604c38c45e 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -43,11 +43,11 @@ M: bignum ^n M: ratio ^n [ >fraction ] dip '[ _ ^n ] bi@ / ; -M: float ^n (^n) ; +M: float ^n [ >float fpow ] unless-zero ; M: complex ^n (^n) ; -: integer^ ( x y -- z ) +: ^integer ( x y -- z ) dup 0 >= [ ^n ] [ [ recip ] dip neg ^n ] if ; inline PRIVATE> @@ -99,7 +99,7 @@ PRIVATE> : ^ ( x y -- x^y ) { { [ over zero? ] [ 0^ ] } - { [ dup integer? ] [ integer^ ] } + { [ dup integer? ] [ ^integer ] } { [ 2dup real^? ] [ [ >float ] bi@ fpow ] } [ ^complex ] } cond ; inline