 <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

M: real absq sq ;

: ~abs ( x y epsilon -- ? )
    >r - abs r> < ;

: ~rel ( x y epsilon -- ? )
    >r [ - abs ] 2keep [ abs ] bi@ + r> * < ;

: ~ ( x y epsilon -- ? )
    {
        { [ pick fp-nan? pick fp-nan? or ] [ 3drop f ] }
        { [ dup zero? ] [ drop number= ] }
        { [ dup 0 < ] [ ~rel ] }
        [ ~abs ]


: ^mod ( x y n -- z )
    over 0 < [
        [ [ neg ] dip ^mod ] keep mod-inv
    ] [
        -rot (^mod)
    ] if ; foldable
