From: Jarkko Hietaniemi Date: Wed, 9 Apr 1997 18:04:23 +0000 (+0300) Subject: Complex.pm: 0**0 sanity X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b0399d3c2d4e16b936b7db5a1aa3f810e4a39864;p=p5sagit%2Fp5-mst-13.2.git Complex.pm: 0**0 sanity private-msgid: 199704091804.VAA13930@alpha.hut.fi --- diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index 20762bd..7d5a014 100644 --- a/lib/Math/Complex.pm +++ b/lib/Math/Complex.pm @@ -272,6 +272,21 @@ sub divbyzero { } # +# zerotozero +# +# Die on zero raised to the zeroth. +# +sub zerotozero { + my $mess = "The zero raised to the zeroth power is not defined.\n"; + + my @up = caller(1); + + $mess .= "Died at $up[1] line $up[2].\n"; + + die $mess; +} + +# # (divide) # # Computes z1/z2. @@ -302,6 +317,7 @@ sub divide { # sub power { my ($z1, $z2, $inverted) = @_; + zerotozero if ($z1 == 0 and $z2 == 0); return exp($z1 * log $z2) if defined $inverted && $inverted; return exp($z2 * log $z1); }