package Math::Complex;
-$VERSION = "1.30";
-
our($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $Inf);
+$VERSION = 1.31;
+
BEGIN {
unless ($^O eq 'unicosmk') {
my $e = $!;
my %obj = %{$self->{display_format}};
@display_format{keys %obj} = values %obj;
}
- if (@_ == 1) {
- $display_format{style} = shift;
- } else {
- my %new = @_;
- @display_format{keys %new} = values %new;
- }
- } else { # Called as a class method
- if (@_ = 1) {
- $display_format{style} = $self;
- } else {
- my %new = @_;
- @display_format{keys %new} = values %new;
- }
- undef $self;
+ }
+ if (@_ == 1) {
+ $display_format{style} = shift;
+ } else {
+ my %new = @_;
+ @display_format{keys %new} = values %new;
}
- if (defined $self) {
+ if (ref $self) { # Called as an object method
$self->{display_format} = { %display_format };
return
wantarray ?
$self->{display_format}->{style};
}
+ # Called as a class method
%DISPLAY_FORMAT = %display_format;
return
wantarray ?
use Math::Complex;
-my $VERSION = sprintf("%s", q$Id: complex.t,v 1.9 1998/11/01 00:00:00 dsl Exp $ =~ /(\d+\.d+)/);
+use vars qw($VERSION);
+
+$VERSION = 1.91;
my ($args, $op, $target, $test, $test_set, $try, $val, $zvalue, @set, @val);
test_broot(qw(-3 -2.1 0 0.99));
sub test_display_format {
+ $test++;
+ push @script, <<EOS;
+ print "# package display_format cartesian?\n";
+ print "not " unless Math::Complex->display_format eq 'cartesian';
+ print "ok $test\n";
+EOS
+
push @script, <<EOS;
my \$j = (root(1,3))[1];
$test++;
push @script, <<EOS;
- print "# display_format polar?\n";
+ print "# j display_format polar?\n";
print "not " unless \$j->display_format eq 'polar';
print "ok $test\n";
EOS
\$j->display_format('style' => 'cartesian', 'format' => '(%.5g)');
EOS
+
$test++;
push @script, <<EOS;
print "# j = \$j\n";
print "not " unless "\$j" eq "(-0.5)+(0.86603)i";
print "ok $test\n";
EOS
+
+ $test++;
+ push @script, <<EOS;
+ print "# j display_format cartesian?\n";
+ print "not " unless \$j->display_format eq 'cartesian';
+ print "ok $test\n";
+EOS
}
test_display_format();