Skip Menu |

This queue is for tickets about the Data-BitStream CPAN distribution.

Report information
The Basics
Id: 109561
Status: resolved
Priority: 0/
Queue: Data-BitStream

People
Owner: DANAJ [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc: ANDK [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.08
Fixed in: (no value)



CC: ANDK [...] cpan.org
Subject: t/14-range.t fails with perl 5.23.5
The test suite fails with perl 5.23.5. It did not fail with perl 5.23.4 or earlier perl versions, so this might be a perl regression (@ANDK: this looks like a bisect candidate) # Failed test 'minimalvec: BVZeta(2) range patterns' # at t/14-range.t line 51. # Structures begin differing at: # $got->[7] = '2' # $expected->[7] = '0' # Looks like you failed 1 test of 57. t/14-range.t ................. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/57 subtests
Thanks. Bisecting the changes is probably a better method, but just in case I took a look at my code. The issues shows up in BoldiVigna.pm put_boldivigna in the case of encoding ~0-2 followed by 0, where the problem shows up with the 0. $v = 0 $hk = 0 my $x = $v - (1 << $hk) + 1; should yield $x = 0 but instead $x = 1.84467440737095516e+19. Using Devel::Peek with 5.23.2 and 5.23.5: v is an IV with READONLY flag hk is an NV (IV=0, NV=0, PV=0) x was an IV (IV=0) x is now an NV (IV=-4611686018427387906, NV=1.84467440737095516e+19, PV=0) Because this doesn't show up with either number encoded by itself, and on the previous call $hk was 62, I have a suspicion that we're somehow using the old value of the lexical variable $hk. 0 - (1 << 62) + 1 is within rounding of the new value. Changing the line to: my $x = ($hk == 0) ? $v : $v - (1 << $hk) + 1; makes it work. If things were working correctly, this wouldn't matter. It looks like Math::Prime::Util's pure Perl invmod() also has an issue with the new perl: MPU_NO_XS=1 perl -Iblib/lib -Iblib/arch -Mntheory=:all -E 'say invmod(13, 9223372036854775808); say invmod(14,18446744073709551615)' 5675921253449092805 17129119497016012214 has the last result wrong with 5.23.5. Again this is a case where running one invmod by itself is fine, but two in a row gets things wrong. Something is perhaps not getting initialized?
Clarifying that the results shown below are what we expect, and match Pari/GP. For Perl 5.23.5 the internal results of the Euclidian algorithm are very different, and the result ends up being off by one (at least in my long-double build). On Tue Nov 24 04:56:46 2015, DANAJ wrote: Show quoted text
> It looks like Math::Prime::Util's pure Perl invmod() also has an issue > with the new perl: > > MPU_NO_XS=1 perl -Iblib/lib -Iblib/arch -Mntheory=:all -E 'say > invmod(13, 9223372036854775808); say invmod(14,18446744073709551615)' > 5675921253449092805 > 17129119497016012214
Bisect leads to v5.23.4-97-gedba15b, same constellation as https://rt.perl.org/rt3/Ticket/Display.html?id=126635
On Tue Nov 24 14:21:51 2015, ANDK wrote: Show quoted text
> Bisect leads to v5.23.4-97-gedba15b, same constellation as > https://rt.perl.org/rt3/Ticket/Display.html?id=126635
Thank you! I tried blead and that fixes both this and the Math::Prime::Util issues.
Closing since this was an issue in a Perl dev release that was fixed in the next one. Thanks for reporting, and thanks to everyone involved in making the Perl core better in performance and reliability.