Documentation for method Complex
assembled from the following pages:
Class: ComplexStr §
From ComplexStr
(ComplexStr) method Complex §
method Complex
Returns the Complex
value of the ComplexStr
.
Role: Real §
From Real
(Real) method Complex §
method Complex(Real: --> Complex)
Converts the number to a Complex
with the number converted to a Num
as its real part and 0e0 as the imaginary part.
Class: Cool §
From Cool
(Cool) method Complex §
Defined as:
multi method Complex()
Coerces the invocant to a Numeric
and calls its .Complex
method. Fails if the coercion to a Numeric
cannot be done.
say 1+1i.Complex; # OUTPUT: «1+1i» say π.Complex; # OUTPUT: «3.141592653589793+0i» say <1.3>.Complex; # OUTPUT: «1.3+0i» say (-4/3).Complex; # OUTPUT: «-1.3333333333333333+0i» say "foo".Complex.^name; # OUTPUT: «Failure»