From 5240e57461d2250452128643181252f0618b2549 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Tue, 2 May 2000 00:36:46 +0000 Subject: [PATCH] Infinite problems. p4raw-id: //depot/cfgperl@6039 --- lib/Math/Complex.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index 4439e56..b13191b 100644 --- a/lib/Math/Complex.pm +++ b/lib/Math/Complex.pm @@ -19,9 +19,9 @@ BEGIN { my $e = $!; $Inf = CORE::exp(CORE::exp(30)); $! = $e; # Clear ERANGE. - undef $Inf unless $Inf =~ /^inf$/; # Inf INF inf } - $Inf = "Inf" if !defined $Inf || !($Inf > 0); + undef $Inf unless $Inf =~ /^inf(?:inity)?$/i; # Inf INF inf Infinity + $Inf = "Inf" if !defined $Inf || !($Inf > 0); # Desperation. } use strict; @@ -998,8 +998,6 @@ sub cosh { return $ex ? ($ex + 1/$ex)/2 : $Inf; } my ($x, $y) = @{$z->cartesian}; - my $cy = CORE::cos($y); - my $sy = CORE::cos($y); $ex = CORE::exp($x); my $ex_1 = $ex ? 1 / $ex : $Inf; return (ref $z)->make(CORE::cos($y) * ($ex + $ex_1)/2, @@ -1024,8 +1022,8 @@ sub sinh { my $sy = CORE::sin($y); $ex = CORE::exp($x); my $ex_1 = $ex ? 1 / $ex : $Inf; - return (ref $z)->make($cy * ($ex - $ex_1)/2, - $sy * ($ex + $ex_1)/2); + return (ref $z)->make(CORE::cos($y) * ($ex - $ex_1)/2, + CORE::sin($y) * ($ex + $ex_1)/2); } # -- 2.7.4