Skip Menu |

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 81893
Status: rejected
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: DONANGEL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.997
Fixed in: (no value)



Subject: Problem module in Perl 5.17.x
Hi Peter John Acklam, I found a important problem Math-BigInt (v.>=1.99x, and possible and others versions) when it is used in Perl v.5.17.x. The problem is not the correct operator: /= E.g. fragment of the code: #========================= use Data::Dumper use Math::BigInt qw( bgcd ); my @m = (2, 4, 16); my $gcd = bgcd( @m ); $_ /= $gcd for @m ; print Dumper \@m; #========================= #=== Ok result! output in perl 5.12.4 (or < 5.12) ==== $VAR1 = [ bless( { 'value' => [ 1 ], 'sign' => '+' }, 'Math::BigInt' ), bless( { 'value' => [ 2 ], 'sign' => '+' }, 'Math::BigInt' ), bless( { 'value' => [ 8 ], 'sign' => '+' }, 'Math::BigInt' ) ]; #========================= #=== False result! output in perl 5.17.5 (or 5.17.x) ==== $VAR1 = [ bless( { 'value' => [ 0 ], 'sign' => '+' }, 'Math::BigInt' ), $VAR1->[0], $VAR1->[0] ]; #========================= Thanks, Alessandro Gorohovski
I have tried to reproduce this behaviour with all versions of Math::BigInt from 1.35 an onwards together with versions of Perl all the way from 5.8.1 to 5.19.10, but I am not getting the behaviour you describe. I have not tested with Perl 5.17.x since this is a superseded development version. I think this might be a problem with 5.17.x or with Data::Dumper or the combination of the two. If I am to look into this any further, please provide the exact versions of Data::Dumper and Math::BigInt you are using. You can view this with the following commands: perl -MData::Dumper -wle 'print Data::Dumper -> VERSION' perl -MMath::BigInt -wle 'print Math::BigInt -> VERSION'
I can reproduce this with 5.17.{6,7,8,9}, but it works fine in 5.16.2 and 5.18.0 (and every other version I tried). It's not a Data::Dumper issue. It's also not a bgcd issue. perlbrew exec perl -e 'use Math::BigInt; my @m=(2,4,16);my $gcd=Math::BigInt->new(2); $_ /= $gcd for @m; print "@m Perl $] BigInt $Math::BigInt::VERSION\n";' 1 2 8 Perl 5.006002 BigInt 1.991 1 2 8 Perl 5.008002 BigInt 1.89 1 2 8 Perl 5.008009 BigInt 1.997 1 2 8 Perl 5.010001 BigInt 1.89 1 2 8 Perl 5.016002 BigInt 1.998 0 0 0 Perl 5.017006 BigInt 1.998 0 0 0 Perl 5.017007 BigInt 1.998 0 0 0 Perl 5.017008 BigInt 1.998 0 0 0 Perl 5.017009 BigInt 1.999 1 2 8 Perl 5.018000 BigInt 1.9991 1 2 8 Perl 5.018001 BigInt 1.9991 1 2 8 Perl 5.019002 BigInt 1.9992 1 2 8 Perl 5.019003 BigInt 1.9992 1 2 8 Perl 5.019004 BigInt 1.9993 1 2 8 Perl 5.019005 BigInt 1.9993 1 2 8 Perl 5.019007 BigInt 1.9993 The Math/BigInt.pm and Math/BigInt/Calc.pm files are identical in my 5.16.2 and 5.17.6. The problem is in: $_ /= $gcd for @m; These work fine: $_ = $_ / $gcd for @m; @m = map { $_ / $gcd } @m; $_ /= "$gcd" for @m; # cheat: doesn't work for big $gcd Since this only happens in obsolete dev versions, and it's not directly module related, this seems like something that could be closed. I might guess this was related to some of the COW experiments?
Apologies for yet another comment. I get identical failures with Math::BigFloat and Math::GMPz. It doesn't happen with Math::GMP, Math::Pari, or Math::Int128. On any of them, making the elements of @m be objects also makes the issue go away. The identical failure with Math::GMPz is a stronger indication that this is a 5.17.x problem and not something Math::BigInt should be worrying about. If it does come up later, it is in /= with mixed scalar/object arguments.
I am not able to reproduce this bug. I suspect it was a problem specific to perl-5.17.*
Subject: Re: [rt.cpan.org #81893] Problem module in Perl 5.17.x
Date: Wed, 04 Jun 2014 16:13:09 +0300
To: bug-Math-BigInt [...] rt.cpan.org
From: "Alessandro Gorohovski" <an.gorohovski [...] gmail.com>
Hello Peter, Ok. Understand. Have a nice day, Alessandro Peter John Acklam via RT <bug-Math-BigInt@rt.cpan.org> писал(а) в своём письме Wed, 04 Jun 2014 10:24:28 +0300: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=81893 > > > I am not able to reproduce this bug. I suspect it was a problem specific > to perl-5.17.*
-- ANG