=begin pod

=TITLE class Complex

=SUBTITLE Complex number

    class Complex is Cool does Numeric { ... }

Represents a number in the complex plane.

Complex objects are immutable.

=head1 Operators

=head2 postfix i

Adding a trailing C<i> to a number literal makes it a Complex, for example:

    2i;     # same as Complex.new(0, 2);
    1-2e3i; # same as Complex.new(1, -2e3);

=head1 Methods

=head2 method new

Defined as:

    proto method new(*@, *%) {*} returns Complex:D
    multi method new(Real $re, Real $im) returns Complex:D

Usage:

    $complex = Complex.new(REAL, IMAGINARY)

Creates a new C<Complex> object from real and imaginary parts.

=head2 method re

Defined as:

    method re(Complex:D:) returns Real:D

Usage:

   COMPLEX.re

Returns the real part of the complex number.

=head2 method im

Defined as:

    method im(Complex:D:) returns Real:D

Usage:

    COMPLEX.im

Returns the imaginary part of the complex number.

=head2 method isNaN

Defined as:

    method isNaN(Complex:D:) returns Bool:D

Usage:

    COMPLEX.isNaN

Returns true if the real or imaginary part is C<NaN> (not a number).

=head2 method polar

Defined as:

    method polar(Complex:D:) returns Positional:D

Usage:

    COMPLEX.polar

Returns a two-element list of the polar coordinates for this value,
i.e. magnitude and angle in radians.

=end pod
