Skip to content

Commit e8502de

Browse files
committed
[Complex] add polar; fix "returns" traits
1 parent f10aa0d commit e8502de

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/Complex.pod

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,34 @@ Adding a trailing C<i> to a number literal makes it a Complex, for example
1717
1818
=head2 new
1919
20-
proto method new(*@, *%) {*}
21-
multi method new(Real $re, Real $im)
20+
proto method new(*@, *%) {*} returns Complex:D
21+
multi method new(Real $re, Real $im) returns Complex:D
2222
2323
Creates a new C<Complex> object from a the real and imaginary part.
2424
2525
=head2 re
2626
27-
method re(Complex:D:) return Real:D
27+
method re(Complex:D:) returns Real:D
2828
2929
Returns the real part of the complex number
3030
3131
=head2 im
3232
33-
method im(Complex:D:) return Real:D
33+
method im(Complex:D:) returns Real:D
3434
3535
Returns the imaginary part of the complex number
3636
3737
=head2 isNaN
3838
39-
method isNaN(Complex:D:) return Bool:D
39+
method isNaN(Complex:D:) returns Bool:D
4040
4141
Returns true if the real or imaginary part is C<NaN> (not a number)
4242
43+
=head2 polar
44+
45+
method polar(Complex:D:) returns Positional:D
46+
47+
Returns a two-element list of the polar coordinates for this value,
48+
ie magnitude and angle in radians.
49+
4350
=end pod

0 commit comments

Comments
 (0)