In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/92c15a4926e73f5173fda2ca3f08cf8fff3b49ab?hp=3a3dd4dc90787e9c4c4daa08e3dc43e911abf63c>
- Log ----------------------------------------------------------------- commit 92c15a4926e73f5173fda2ca3f08cf8fff3b49ab Author: Eric Herman <[email protected]> Date: Mon Jun 26 16:48:58 2017 +0200 Update Math-BigRat to CPAN version 0.2613 Includes test addressing Bug #131410: "Math::BigRat in perl-5.26.0-RC2 severely broken" https://rt.perl.org/Public/Bug/Display.html?id=131410 See Also: http://code.activestate.com/lists/perl5-porters/236513/ https://rt.cpan.org/Ticket/Display.html?id=121139 ----------------------------------------------------------------------- Summary of changes: MANIFEST | 1 + Porting/Maintainers.pl | 2 +- cpan/Math-BigRat/lib/Math/BigRat.pm | 28 +++++++++++++++++----------- cpan/Math-BigRat/t/rt121139.t | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 cpan/Math-BigRat/t/rt121139.t diff --git a/MANIFEST b/MANIFEST index 795a991322..38b908e90d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1815,6 +1815,7 @@ cpan/Math-BigRat/t/bitwise.t Math::BigRat test cpan/Math-BigRat/t/hang.t Math::BigRat test for bug #34584 - hang in exp() cpan/Math-BigRat/t/Math/BigRat/Test.pm Math::BigRat test helper cpan/Math-BigRat/t/requirer.t see if require works properly +cpan/Math-BigRat/t/rt121139.t cpan/Math-BigRat/t/trap.t see if trap_nan and trap_inf work cpan/Math-Complex/lib/Math/Complex.pm A Complex package cpan/Math-Complex/lib/Math/Trig.pm A simple interface to complex trigonometry diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 9ae08c9ad7..d963396aec 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -750,7 +750,7 @@ use File::Glob qw(:case); }, 'Math::BigRat' => { - 'DISTRIBUTION' => 'PJACKLAM/Math-BigRat-0.2611.tar.gz', + 'DISTRIBUTION' => 'PJACKLAM/Math-BigRat-0.2613.tar.gz', 'FILES' => q[cpan/Math-BigRat], 'EXCLUDED' => [ qr{^t/author-}, diff --git a/cpan/Math-BigRat/lib/Math/BigRat.pm b/cpan/Math-BigRat/lib/Math/BigRat.pm index c604a2706f..520b443b01 100644 --- a/cpan/Math-BigRat/lib/Math/BigRat.pm +++ b/cpan/Math-BigRat/lib/Math/BigRat.pm @@ -18,9 +18,9 @@ use warnings; use Carp (); -use Math::BigFloat '1.999718'; +use Math::BigFloat 1.999718; -our $VERSION = '0.2611'; +our $VERSION = '0.2613'; our @ISA = qw(Math::BigFloat); @@ -887,9 +887,11 @@ sub bmul { my $gcd_sq = $LIB -> _gcd($LIB -> _copy($y->{_n}), $x->{_d}); $x->{_n} = $LIB -> _mul(scalar $LIB -> _div($x->{_n}, $gcd_pr), - scalar $LIB -> _div($y->{_n}, $gcd_sq)); + scalar $LIB -> _div($LIB -> _copy($y->{_n}), + $gcd_sq)); $x->{_d} = $LIB -> _mul(scalar $LIB -> _div($x->{_d}, $gcd_sq), - scalar $LIB -> _div($y->{_d}, $gcd_pr)); + scalar $LIB -> _div($LIB -> _copy($y->{_d}), + $gcd_pr)); # compute new sign $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; @@ -1348,15 +1350,19 @@ sub blog { # value is used as the base, otherwise the base is assumed to be Euler's # constant. + my ($class, $x, $base, @r); + # Don't objectify the base, since an undefined base, as in $x->blog() or # $x->blog(undef) signals that the base is Euler's number. - # set up parameters - my ($class, $x, $base, @r) = (ref($_[0]), @_); - - # objectify is costly, so avoid it - if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { - ($class, $x, $base, @r) = objectify(1, @_); + if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) { + # E.g., Math::BigFloat->blog(256, 2) + ($class, $x, $base, @r) = + defined $_[2] ? objectify(2, @_) : objectify(1, @_); + } else { + # E.g., Math::BigFloat::blog(256, 2) or $x->blog(2) + ($class, $x, $base, @r) = + defined $_[1] ? objectify(2, @_) : objectify(1, @_); } return $x if $x->modify('blog'); @@ -1417,7 +1423,7 @@ sub bexp { # objectify is costly, so avoid it if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) { - ($class, $x, $y, @r) = objectify(2, @_); + ($class, $x, $y, @r) = objectify(1, @_); } return $x->binf(@r) if $x->{sign} eq '+inf'; diff --git a/cpan/Math-BigRat/t/rt121139.t b/cpan/Math-BigRat/t/rt121139.t new file mode 100644 index 0000000000..b0cd214ad3 --- /dev/null +++ b/cpan/Math-BigRat/t/rt121139.t @@ -0,0 +1,16 @@ +#!perl + +# check for cpan rt #121139 + +use strict; +use warnings; +use Test::More tests => 2; +use Math::BigRat; + +my $a = Math::BigRat->new('3/2'); +my $x = Math::BigRat->new('2/3'); +is("$a", "3/2"); + +my $y = $a; +$y = $x * $y; +is("$a", "3/2"); -- Perl5 Master Repository
