Skip to content

Commit 99dd877

Browse files
committed
Update 02-14complex-number.pl
1 parent a4a4673 commit 99dd877

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

categories/cookbook/02numbers/02-14complex-number.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@
1414

1515
say sqrt(3+4i); # 2+1i
1616

17+
say abs(3+4i); # 5 (absolute value of complex number or "modulus")
18+
19+
say (3+4i).re; # 3 (real part)
20+
21+
say (3+4i).im; # 4 (imaginary part)
22+
1723
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)