RosettaCodeData/Task/Arithmetic-Complex/Perl/arithmetic-complex.pl

11 lines
248 B
Perl
Raw Permalink Normal View History

2013-04-10 14:58:50 -07:00
use Math::Complex;
my $a = 1 + 1*i;
my $b = 3.14159 + 1.25*i;
print "$_\n" foreach
$a + $b, # addition
$a * $b, # multiplication
-$a, # negation
1 / $a, # multiplicative inverse
~$a; # complex conjugate