summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Math/Complex.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Math/Complex.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/Math/Complex.pm43
1 files changed, 31 insertions, 12 deletions
diff --git a/Master/tlpkg/tlperl/lib/Math/Complex.pm b/Master/tlpkg/tlperl/lib/Math/Complex.pm
index 8475a2b5d09..19fb16486bf 100644
--- a/Master/tlpkg/tlperl/lib/Math/Complex.pm
+++ b/Master/tlpkg/tlperl/lib/Math/Complex.pm
@@ -7,14 +7,14 @@
package Math::Complex;
+{ use 5.006; }
use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $Inf $ExpInf);
-
-$VERSION = 1.56;
+our $VERSION = 1.59;
use Config;
+our($Inf, $ExpInf);
BEGIN {
my %DBL_MAX =
(
@@ -96,7 +96,7 @@ my $gre = qr'\s*([\+\-]?(?:(?:(?:\d+(?:_\d+)*(?:\.\d*(?:_\d+)*)?|\.\d+(?:_\d+)*)
require Exporter;
-@ISA = qw(Exporter);
+our @ISA = qw(Exporter);
my @trig = qw(
pi
@@ -110,7 +110,7 @@ my @trig = qw(
acsch acosech asech acoth acotanh
);
-@EXPORT = (qw(
+our @EXPORT = (qw(
i Re Im rho theta arg
sqrt log ln
log10 logn cbrt root
@@ -121,18 +121,24 @@ my @trig = qw(
my @pi = qw(pi pi2 pi4 pip2 pip4 Inf);
-@EXPORT_OK = @pi;
+our @EXPORT_OK = @pi;
-%EXPORT_TAGS = (
+our %EXPORT_TAGS = (
'trig' => [@trig],
'pi' => [@pi],
);
use overload
+ '=' => \&_copy,
+ '+=' => \&_plus,
'+' => \&_plus,
+ '-=' => \&_minus,
'-' => \&_minus,
+ '*=' => \&_multiply,
'*' => \&_multiply,
+ '/=' => \&_divide,
'/' => \&_divide,
+ '**=' => \&_power,
'**' => \&_power,
'==' => \&_numeq,
'<=>' => \&_spaceship,
@@ -144,7 +150,6 @@ use overload
'log' => \&log,
'sin' => \&sin,
'cos' => \&cos,
- 'tan' => \&tan,
'atan2' => \&atan2,
'""' => \&_stringify;
@@ -217,6 +222,19 @@ sub _emake {
return ($p, $q);
}
+sub _copy {
+ my $self = shift;
+ my $clone = {%$self};
+ if ($self->{'cartesian'}) {
+ $clone->{'cartesian'} = [@{$self->{'cartesian'}}];
+ }
+ if ($self->{'polar'}) {
+ $clone->{'polar'} = [@{$self->{'polar'}}];
+ }
+ bless $clone,__PACKAGE__;
+ return $clone;
+}
+
#
# ->make
#
@@ -1539,7 +1557,7 @@ sub _stringify_polar {
if (defined $format) {
$r = sprintf($format, $r);
- $theta = sprintf($format, $theta) unless defined $theta;
+ $theta = sprintf($format, $t) unless defined $theta;
} else {
$theta = $t unless defined $theta;
}
@@ -2077,9 +2095,10 @@ L<Math::Trig>
=head1 AUTHORS
-Daniel S. Lewart <F<lewart!at!uiuc.edu>>
-Jarkko Hietaniemi <F<jhi!at!iki.fi>>
-Raphael Manfredi <F<Raphael_Manfredi!at!pobox.com>>
+Daniel S. Lewart <F<lewart!at!uiuc.edu>>,
+Jarkko Hietaniemi <F<jhi!at!iki.fi>>,
+Raphael Manfredi <F<Raphael_Manfredi!at!pobox.com>>,
+Zefram <zefram@fysh.org>
=head1 LICENSE