In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/51fb4aa5d9388dd514ae1ad368722ed2997ee27a?hp=7bd819935395fd684e09e3c97918ba0ad387288a>
- Log ----------------------------------------------------------------- commit 51fb4aa5d9388dd514ae1ad368722ed2997ee27a Author: Steve Hay <[email protected]> Date: Thu Oct 29 13:54:23 2015 +0000 Upgrade Math-BigInt from version 1.999705 to 1.999706 ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 2 +- cpan/Math-BigInt/lib/Math/BigFloat.pm | 21 ++++++++++++---- cpan/Math-BigInt/lib/Math/BigInt.pm | 37 +++++++++++++++++++++-------- cpan/Math-BigInt/lib/Math/BigInt/Calc.pm | 2 +- cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm | 2 +- cpan/Math-BigInt/t/bare_mbf.t | 2 +- cpan/Math-BigInt/t/bigfltpm.inc | 11 +++++++++ cpan/Math-BigInt/t/bigfltpm.t | 2 +- cpan/Math-BigInt/t/bigintpm.inc | 14 ++++++++--- cpan/Math-BigInt/t/sub_mbf.t | 2 +- cpan/Math-BigInt/t/with_sub.t | 2 +- 11 files changed, 73 insertions(+), 24 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index ed09dd0..8a3e1a1 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -722,7 +722,7 @@ use File::Glob qw(:case); }, 'Math::BigInt' => { - 'DISTRIBUTION' => 'PJACKLAM/Math-BigInt-1.999705.tar.gz', + 'DISTRIBUTION' => 'PJACKLAM/Math-BigInt-1.999706.tar.gz', 'FILES' => q[cpan/Math-BigInt], 'EXCLUDED' => [ qr{^inc/}, diff --git a/cpan/Math-BigInt/lib/Math/BigFloat.pm b/cpan/Math-BigInt/lib/Math/BigFloat.pm index d95ed23..5983f2d 100644 --- a/cpan/Math-BigInt/lib/Math/BigFloat.pm +++ b/cpan/Math-BigInt/lib/Math/BigFloat.pm @@ -12,7 +12,7 @@ package Math::BigFloat; # _a : accuracy # _p : precision -$VERSION = '1.999705'; +$VERSION = '1.999706'; require 5.006002; require Exporter; @@ -437,10 +437,23 @@ sub bsstr sub numify { - # Convert a Perl scalar number from a BigFloat object. - # Create a string and let Perl's atoi()/atof() handle the rest. + # Make a Perl scalar number from a Math::BigFloat object. my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_); - return 0 + $x->bsstr(); + + if ($x -> is_nan()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $inf - $inf; + } + + if ($x -> is_inf()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $x -> is_negative() ? -$inf : $inf; + } + + # Create a string and let Perl's atoi()/atof() handle the rest. + return 0 + $x -> bsstr(); } ############################################################################## diff --git a/cpan/Math-BigInt/lib/Math/BigInt.pm b/cpan/Math-BigInt/lib/Math/BigInt.pm index 2710264..45b888e 100644 --- a/cpan/Math-BigInt/lib/Math/BigInt.pm +++ b/cpan/Math-BigInt/lib/Math/BigInt.pm @@ -18,7 +18,7 @@ package Math::BigInt; my $class = "Math::BigInt"; use 5.006002; -$VERSION = '1.999705'; +$VERSION = '1.999706'; @ISA = qw(Exporter); @EXPORT_OK = qw(objectify bgcd blcm); @@ -846,13 +846,23 @@ sub bstr sub numify { - # Make a "normal" scalar from a BigInt object + # Make a Perl scalar number from a Math::BigInt object. my $x = shift; $x = $class->new($x) unless ref $x; - return $x->bstr() if $x->{sign} !~ /^[+-]$/; - my $num = $CALC->_num($x->{value}); - return -$num if $x->{sign} eq '-'; - $num; + if ($x -> is_nan()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $inf - $inf; + } + + if ($x -> is_inf()) { + require Math::Complex; + my $inf = Math::Complex::Inf(); + return $x -> is_negative() ? -$inf : $inf; + } + + my $num = 0 + $CALC->_num($x->{value}); + return $x->{sign} eq '-' ? -$num : $num; } ############################################################################## @@ -5182,13 +5192,20 @@ is in effect, they will always hand up their work: =item bexp() -=back +=item bpi() + +=item bcos() -Beware: This list is not complete. +=item bsin() + +=item batan2() + +=item batan() + +=back All other methods upgrade themselves only when one (or all) of their -arguments are of the class mentioned in $upgrade (This might change in later -versions to a more sophisticated scheme): +arguments are of the class mentioned in $upgrade. =head1 EXPORTS diff --git a/cpan/Math-BigInt/lib/Math/BigInt/Calc.pm b/cpan/Math-BigInt/lib/Math/BigInt/Calc.pm index bb863da..7203cec 100644 --- a/cpan/Math-BigInt/lib/Math/BigInt/Calc.pm +++ b/cpan/Math-BigInt/lib/Math/BigInt/Calc.pm @@ -4,7 +4,7 @@ use 5.006002; use strict; # use warnings; # do not use warnings for older Perls -our $VERSION = '1.999705'; +our $VERSION = '1.999706'; # Package to store unsigned big integers in decimal and do math with them diff --git a/cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm b/cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm index be2787c..685cc65 100644 --- a/cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm +++ b/cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm @@ -5,7 +5,7 @@ use strict; # use warnings; # do not use warnings for older Perls use vars qw/$VERSION/; -$VERSION = '1.999705'; +$VERSION = '1.999706'; package Math::BigInt; diff --git a/cpan/Math-BigInt/t/bare_mbf.t b/cpan/Math-BigInt/t/bare_mbf.t index 6eeefa7..28cd9fb 100644 --- a/cpan/Math-BigInt/t/bare_mbf.t +++ b/cpan/Math-BigInt/t/bare_mbf.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 2360; +use Test::More tests => 2363; BEGIN { unshift @INC, 't'; } diff --git a/cpan/Math-BigInt/t/bigfltpm.inc b/cpan/Math-BigInt/t/bigfltpm.inc index bbfca4e..c601cc2 100644 --- a/cpan/Math-BigInt/t/bigfltpm.inc +++ b/cpan/Math-BigInt/t/bigfltpm.inc @@ -269,6 +269,17 @@ like($class->new("1e-9999")->numify(), qr/^\+?0$/); # underflow unlike($class->new("1e9999")->numify(), qr/^1(\.0*)?e\+?9+$/); # overflow ############################################################################### +# Check numify on non-finite objects. + +{ + my $inf = 1e99 ** 1e99; + my $nan = $inf - $inf; + is($class -> binf("+") -> numify(), $inf, "numify of +Inf"); + is($class -> binf("-") -> numify(), -$inf, "numify of -Inf"); + is($class -> bnan() -> numify(), $nan, "numify of NaN"); +} + +############################################################################### # fsqrt() with set global A/P or A/P enabled on $x, also a test whether fsqrt() # correctly modifies $x diff --git a/cpan/Math-BigInt/t/bigfltpm.t b/cpan/Math-BigInt/t/bigfltpm.t index 53006e7..9e33d48 100644 --- a/cpan/Math-BigInt/t/bigfltpm.t +++ b/cpan/Math-BigInt/t/bigfltpm.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 2360 +use Test::More tests => 2363 + 5; # own tests diff --git a/cpan/Math-BigInt/t/bigintpm.inc b/cpan/Math-BigInt/t/bigintpm.inc index 0b8206e..2e027de 100644 --- a/cpan/Math-BigInt/t/bigintpm.inc +++ b/cpan/Math-BigInt/t/bigintpm.inc @@ -520,6 +520,17 @@ is ($x,-3); is (ref($x),'Math::Foo'); ############################################################################### +# Check numify on non-finite objects. + +{ + my $inf = 1e99 ** 1e99; + my $nan = $inf - $inf; + is($class -> binf("+") -> numify(), $inf, "numify of +Inf"); + is($class -> binf("-") -> numify(), -$inf, "numify of -Inf"); + is($class -> bnan() -> numify(), $nan, "numify of NaN"); +} + +############################################################################### # Test whether +inf eq inf # This tried to test whether BigInt inf equals Perl inf. Unfortunately, Perl # hasn't (before 5.7.3 at least) a consistent way to say inf, and some things @@ -1227,9 +1238,6 @@ bsstrabc:NaN -5:-5e+0 -100:-1e+2 &numify -numifyabc:NaN -+inf:inf --inf:-inf 5:5 -5:-5 100:100 diff --git a/cpan/Math-BigInt/t/sub_mbf.t b/cpan/Math-BigInt/t/sub_mbf.t index 035b129..c7a028a 100644 --- a/cpan/Math-BigInt/t/sub_mbf.t +++ b/cpan/Math-BigInt/t/sub_mbf.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 2360 +use Test::More tests => 2363 + 6; # + our own tests diff --git a/cpan/Math-BigInt/t/with_sub.t b/cpan/Math-BigInt/t/with_sub.t index 86c7684..85d832d 100644 --- a/cpan/Math-BigInt/t/with_sub.t +++ b/cpan/Math-BigInt/t/with_sub.t @@ -3,7 +3,7 @@ # Test use Math::BigFloat with => 'Math::BigInt::SomeSubclass'; use strict; -use Test::More tests => 2360 + 1; +use Test::More tests => 2363 + 1; use Math::BigFloat with => 'Math::BigInt::Subclass', lib => 'Calc'; -- Perl5 Master Repository
