 <PRIVATE
 
 : ^mag ( w abs arg -- magnitude )
-    >r >r >float-rect swap r> swap fpow r> rot * fexp /f ;
-    inline
+    [ >float-rect swap ] [ swap fpow ] [ rot * fexp /f ] tri* ; inline
 
 : ^theta ( w abs arg -- theta )
-    >r >r >float-rect r> flog * swap r> * + ; inline
+    [ >float-rect ] [ flog * swap ] [ * + ] tri* ; inline
 
 : ^complex ( x y -- z )
     swap >polar [ ^mag ] [ ^theta ] 3bi polar> ; inline

    >float dup 0.0 < [ neg fsqrt 0.0 swap rect> ] [ fsqrt ] if ;

: each-bit ( n quot: ( ? -- ) -- )
    over 0 = pick -1 = or [
        2drop
    ] [
        2dup >r >r >r odd? r> call r> 2/ r> each-bit
    ] if ; inline recursive

: map-bits ( n quot: ( ? -- obj ) -- seq )


: (^mod) ( n x y -- z )
    1 swap [
        [ dupd * pick mod ] when [ sq over mod ] dip
    ] each-bit 2nip ; inline

: (gcd) ( b a x y -- a d )
    over zero? [
        2nip
    ] [
        swap [ /mod [ over * swapd - ] dip ] keep (gcd)
    ] if ;

: gcd ( x y -- a d )
    [ 0 1 ] 2dip (gcd) dup 0 < [ neg ] when ; foldable

: lcm ( a b -- c )
    [ * ] 2keep gcd nip /i ; foldable
