diff options
-rwxr-xr-x | Porting/Maintainers.pl | 2 | ||||
-rw-r--r-- | cpan/Math-Complex/lib/Math/Complex.pm | 30 | ||||
-rw-r--r-- | cpan/Math-Complex/lib/Math/Trig.pm | 23 | ||||
-rw-r--r-- | cpan/Math-Complex/t/Complex.t | 19 | ||||
-rw-r--r-- | pod/perldelta.pod | 8 |
5 files changed, 62 insertions, 20 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 446db4909e..e31cb022cd 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1220,7 +1220,7 @@ use File::Glob qw(:case); 'Math::Complex' => { 'MAINTAINER' => 'zefram', - 'DISTRIBUTION' => 'JHI/Math-Complex-1.56.tar.gz', + 'DISTRIBUTION' => 'ZEFRAM/Math-Complex-1.57.tar.gz', 'FILES' => q[cpan/Math-Complex], 'EXCLUDED' => [ qw{ diff --git a/cpan/Math-Complex/lib/Math/Complex.pm b/cpan/Math-Complex/lib/Math/Complex.pm index 8475a2b5d0..a46f66e7ba 100644 --- a/cpan/Math-Complex/lib/Math/Complex.pm +++ b/cpan/Math-Complex/lib/Math/Complex.pm @@ -11,7 +11,7 @@ use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $Inf $ExpInf); -$VERSION = 1.56; +$VERSION = 1.57; use Config; @@ -129,10 +129,16 @@ my @pi = qw(pi pi2 pi4 pip2 pip4 Inf); ); use overload + '=' => \&_copy, + '+=' => \&_plus, '+' => \&_plus, + '-=' => \&_minus, '-' => \&_minus, + '*=' => \&_multiply, '*' => \&_multiply, + '/=' => \&_divide, '/' => \&_divide, + '**=' => \&_power, '**' => \&_power, '==' => \&_numeq, '<=>' => \&_spaceship, @@ -217,6 +223,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 +1558,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 +2096,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 diff --git a/cpan/Math-Complex/lib/Math/Trig.pm b/cpan/Math-Complex/lib/Math/Trig.pm index b7767bebcc..f428ad26c9 100644 --- a/cpan/Math-Complex/lib/Math/Trig.pm +++ b/cpan/Math-Complex/lib/Math/Trig.pm @@ -10,14 +10,14 @@ package Math::Trig; use 5.005; use strict; -use Math::Complex 1.56; +use Math::Complex 1.57; use Math::Complex qw(:trig :pi); use vars qw($VERSION $PACKAGE @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter); -$VERSION = 1.20; +$VERSION = 1.21; my @angcnv = qw(rad2deg rad2grad deg2rad deg2grad @@ -166,19 +166,13 @@ sub great_circle_distance { sub great_circle_direction { my ( $theta0, $phi0, $theta1, $phi1 ) = @_; - my $distance = great_circle_distance($theta0, $phi0, $theta1, $phi1); - my $lat0 = pip2 - $phi0; my $lat1 = pip2 - $phi1; - my $direction = - acos_real((sin($lat1) - sin($lat0) * cos($distance)) / - (cos($lat0) * sin($distance))); - - $direction = pi2 - $direction - if sin($theta1 - $theta0) < 0; - - return rad2rad($direction); + return rad2rad(pi2 - + atan2(sin($theta0-$theta1) * cos($lat1), + cos($lat0) * sin($lat1) - + sin($lat0) * cos($lat1) * cos($theta0-$theta1))); } *great_circle_bearing = \&great_circle_direction; @@ -755,8 +749,9 @@ L<Math::Complex> =head1 AUTHORS -Jarkko Hietaniemi <F<jhi!at!iki.fi>> and -Raphael Manfredi <F<Raphael_Manfredi!at!pobox.com>>. +Jarkko Hietaniemi <F<jhi!at!iki.fi>>, +Raphael Manfredi <F<Raphael_Manfredi!at!pobox.com>>, +Zefram <zefram@fysh.org> =head1 LICENSE diff --git a/cpan/Math-Complex/t/Complex.t b/cpan/Math-Complex/t/Complex.t index 687d6220df..d0d83d3441 100644 --- a/cpan/Math-Complex/t/Complex.t +++ b/cpan/Math-Complex/t/Complex.t @@ -34,6 +34,15 @@ if ($^O eq 'unicos') { # For some reason root() produces very inaccurate } # cos(), sin(), cosh(), sinh(). The division # of doubles is the current suspect. +$test++; +push @script, "{ my \$t=$test; ".q{ + my $a = Math::Complex->new(1); + my $b = $a; + $a += 2; + print "not " unless "$a" eq "3" && "$b" eq "1"; + print "ok $t\n"; +}."}"; + while (<DATA>) { s/^\s+//; next if $_ eq '' || /^\#/; @@ -287,6 +296,15 @@ EOS print "not " unless "\$j" =~ /^\\[1,2\\.09439510\\d+\\]\$/; print "ok $test\n"; + \$j->display_format('style' => 'polar', 'format' => "%.4g"); +EOS + + $test++; + push @script, <<EOS; + print "# j = \$j\n"; + print "not " unless "\$j" =~ /^\\[1,2\\.094\\]\$/; + print "ok $test\n"; + \$j->display_format('style' => 'cartesian', 'format' => '(%.5g)'); EOS @@ -698,6 +716,7 @@ __END__ [1, pi/3]:"[1,pi/3]" [6, -2*pi/3]:"[6,-2pi/3]" [0.5, -9*pi/11]:"[0.5,-9pi/11]" +[1, 0.5]:"[1, 0.5]" { (4,3); [3,2]; (-3,4); (0,2); [2,1] } diff --git a/pod/perldelta.pod b/pod/perldelta.pod index e9dbe0706b..dc6ee16e4e 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -91,6 +91,14 @@ XXX =item * +C<Math::Complex> has been upgraded from version 1.56 to version 1.57. + +Correct copy constructor usage. +Fix polarwise formatting with numeric format specifier. +More stable C<great_circle_direction> algorithm. + +=item * + C<Time::HiRes> has been upgraded from version 1.9721_01 to version 1.9722. Portability fix, and avoiding some compiler warnings. |