\ Help for Complex Floating Point Arithmetic

Note: Complex numbers are stored on the floating point stack with the
        imaginary part on top and the real part second on the stack.

ZDROP   ( Z: z -- )
        Drop a complex number from the floating point stack.

ZDUP   ( Z: z -- z z )
        Duplicate a complex number on the floating point stack.

ZSWAP   ( Z: z1 z2 -- z2 z1 )
        Exchange the top two complex numbers on the floating point stack.

ZNIP    ( Z: z1 z2 -- z2 )
        Drop the second complex number from the floating point stack.

ZNEGATE   ( Z: z1 -- z2 )
        Negate the complex number on the floating point stack.

ZCONJUGATE   ( Z: z1 -- z2 )
        Replace the complex number on the floating point stack with its
        complex conjugate.

ZJ*     ( Z: z1 -- z2 )
        Multiply the complex number on the floating point stack by the
        unit imaginary operator j .

Z+      ( Z: z1 z2 -- z3 )
        Add the two complex numbers on the floating point stack.

Z-      ( Z: z1 z2 -- z3 )
        Subtract the complex number at the top of the floating point
        stack from the complex number second on the floating point
        stack.

Z*      ( Z: z1 z2 -- z3 )
        Replace the top two complex numbers on the floating point stack
        with their complex product.

Z/      ( Z: z1 z2 -- z3 )
        Complex divide the complex number second on the floating point
        stack by the complex number at the top of the floating point
        stack.

ZVARIABLE   ( -- addr )
        Create a variable to hold a complex number.

Z!      ( Z: z -- ; addr -- )
        Store the complex number at the top of the floating point stack
        at the address specified at the top of the parameter stack.

Z@      ( Z: -- z ; addr -- )
        Push a copy of the complex number at the address specified at the
        top of the parameter stack onto the floating point stack.

ZMAG    ( F: r1 r2 -- r3 )
        Replace the top two numbers on the floating point stack with
        the square root of the sum of their squares.  Used to obtain
        the magnitude of a complex number, for example.

TOPOLAR   ( F: x y -- r theta )
        Convert the complex number at the top of the floating point
        stack from its cartesian form to polar form.  The angle is
        in radians.

TOCART   ( F: r theta -- x y )
        Convert a complex number in polar coordinate form to cartesian
        coordinate form.

F^2     ( F: r -- r^2 )
        Square the floating point number on top of the floating point
        stack.

F2/     ( F: r -- r/2 )
        Divide the floating point number at the top of the floating
        point stack by 2.

F2*     ( F: r -- 2*r )
        Multiply the floating point number by 2.

ZSQRT   ( Z: z1 -- z2 )
        Take the complex square root of the complex number at the top
        of the floating point stack.  The root which is returned has
        a positive real part.

-ZSQRT   ( Z: z1 -- z2 )
        Take the complex square root of the complex number, and return
        the root which has a negative real part.


