From: Jarkko Hietaniemi Date: Wed, 23 Apr 1997 00:00:00 +0000 (+0000) Subject: Math::Complex update X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f48376444e1405b4e0150983bc80ff0f594aefce;p=p5sagit%2Fp5-mst-13.2.git Math::Complex update --- diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index a501b99..92504ed 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 Ith root for C is given by: (root(z, n))[k] = r**(1/n) * exp(i * (t + 2*k*pi)/n) -The I 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 comparison operator, E=E, 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 dfc6cb7..4eb08c3 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'