See Original text in context
method Complex
Returns the Complex
value of the ComplexStr
.
See Original text in context
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.
See Original text in context
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»