summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <Jarkko.Hietaniemi@cc.hut.fi>1997-04-23 00:00:00 +0000
committerChip Salzenberg <chip@atlantic.net>1997-04-23 00:00:00 +1200
commitf48376444e1405b4e0150983bc80ff0f594aefce (patch)
tree9fbcbd38f45ff874f0b8d68c3e144d00959ab25f
parent10dd38fc8440f4e4fcf5c186239fc21ecb05d6cb (diff)
downloadperl-f48376444e1405b4e0150983bc80ff0f594aefce.tar.gz
Math::Complex update
-rw-r--r--lib/Math/Complex.pm14
-rwxr-xr-xt/lib/complex.t2
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm
index a501b99ddd..92504ed111 100644
--- a/lib/Math/Complex.pm
+++ b/lib/Math/Complex.pm
@@ -741,7 +741,7 @@ sub cosh {
my ($x, $y) = @{$z->cartesian};
my $ex = exp($x);
my $ex_1 = 1 / $ex;
- return ($ex + $ex_1)/2 if $real;
+ return cplx(0.5 * ($ex + $ex_1), 0) if $real;
return (ref $z)->make(cos($y) * ($ex + $ex_1)/2,
sin($y) * ($ex - $ex_1)/2);
}
@@ -761,7 +761,7 @@ sub sinh {
my ($x, $y) = @{$z->cartesian};
my $ex = exp($x);
my $ex_1 = 1 / $ex;
- return ($ex - $ex_1)/2 if $real;
+ return cplx(0.5 * ($ex - $ex_1), 0) if $real;
return (ref $z)->make(cos($y) * ($ex - $ex_1)/2,
sin($y) * ($ex + $ex_1)/2);
}
@@ -1326,11 +1326,11 @@ The I<k>th root for C<z = [r,t]> is given by:
(root(z, n))[k] = r**(1/n) * exp(i * (t + 2*k*pi)/n)
-The I<spaceship> comparison operator is also defined. In order to
-ensure its restriction to real numbers is conform to what you would
-expect, the comparison is run on the real part of the complex number
-first, and imaginary parts are compared only when the real parts
-match.
+The I<spaceship> comparison operator, E<lt>=E<gt>, is also defined. In
+order to ensure its restriction to real numbers is conform to what you
+would expect, the comparison is run on the real part of the complex
+number first, and imaginary parts are compared only when the real
+parts match.
=head1 CREATION
diff --git a/t/lib/complex.t b/t/lib/complex.t
index dfc6cb7eca..4eb08c3cba 100755
--- a/t/lib/complex.t
+++ b/t/lib/complex.t
@@ -335,7 +335,7 @@ __END__
|'z - ~z':'2*i*Im(z)'
|'z * ~z':'abs(z) * abs(z)'
-{ (2,3); [3,2]; (-3,2); (0,2); 3; 1.2; -3; (-3, 0); (-2, -1); [2,1] }
+{ (2,3); [3,2]; (-3,2); (0,2); 3; 1.2; (-3, 0); (-2, -1); [2,1] }
|'(root(z, 4))[1] ** 4':'z'
|'(root(z, 5))[3] ** 5':'z'