diff options
author | Jarkko Hietaniemi <Jarkko.Hietaniemi@cc.hut.fi> | 1997-04-09 21:04:23 +0300 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-07 00:00:00 +0000 |
commit | b0399d3c2d4e16b936b7db5a1aa3f810e4a39864 (patch) | |
tree | d740bbb07d0628f38c3390f7cce891713616f732 /lib/Math/Complex.pm | |
parent | 948ecc4079304ff4b8604b45d6d9315279e4796e (diff) | |
download | perl-b0399d3c2d4e16b936b7db5a1aa3f810e4a39864.tar.gz |
Complex.pm: 0**0 sanity
private-msgid: 199704091804.VAA13930@alpha.hut.fi
Diffstat (limited to 'lib/Math/Complex.pm')
-rw-r--r-- | lib/Math/Complex.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index 20762bdfa1..7d5a014203 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); } |