From: Jarkko Hietaniemi Date: Sat, 3 Mar 2001 19:00:30 +0000 (+0000) Subject: Integrate change #9006 from maintperl to mainline, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=830ec763789df5f5b0683aa3c9e6ad3d5e5f2fd7;p=p5sagit%2Fp5-mst-13.2.git Integrate change #9006 from maintperl to mainline, more robust quest for the infinite. p4raw-link: @9006 on //depot/maint-5.6/perl: 056c8b5c3eb77101e8713ae76ced9a4cc39b58ed p4raw-id: //depot/perl@9007 p4raw-integrated: from //depot/maint-5.6/perl@9004 'copy in' lib/Math/Complex.pm (@8723..) --- diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index fb6af8c..9812513 100644 --- a/lib/Math/Complex.pm +++ b/lib/Math/Complex.pm @@ -14,10 +14,20 @@ $VERSION = 1.31; BEGIN { unless ($^O eq 'unicosmk') { my $e = $!; - # We do want an arithmetic overflow. - eval '$Inf = CORE::exp(CORE::exp(30))'; + # We do want an arithmetic overflow, Inf INF inf Infinity:. + undef $Inf unless eval <<'EOE' and $Inf =~ /^inf(?:inity)?$/i; + local $SIG{FPE} = sub {die}; + my $t = CORE::exp 30; + $Inf = CORE::exp $t; +EOE + if (!defined $Inf) { # Try a different method + undef $Inf unless eval <<'EOE' and $Inf =~ /^inf(?:inity)?$/i; + local $SIG{FPE} = sub {die}; + my $t = 1; + $Inf = $t + "1e99999999999999999999999999999999"; +EOE + } $! = $e; # Clear ERANGE. - undef $Inf unless $Inf =~ /^inf(?:inity)?$/i; # Inf INF inf Infinity } $Inf = "Inf" if !defined $Inf || !($Inf > 0); # Desperation. }