Skip Menu |
 

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

Report information
The Basics
Id: 110792
Status: resolved
Priority: 0/
Queue: Math-BigInt

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

Bug Information
Severity: Important
Broken in: 1.999712
Fixed in: 1.999713



Subject: new() not parsing float strings correctly.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Message-ID: <rt-4.0.18-17386-1451503186-1561.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1506
Download (untitled) / with headers
text/plain 1.4k
Expected result: perl -Iblib/lib -Iblib/arch -E 'use Math::BigInt lib=>"Calc"; say Math::BigInt->new("716115441142293915.0000000000000000000000")' 716115441142293915 With 1.999712: perl -Iblib/lib -Iblib/arch -E 'use Math::BigInt lib=>"Calc"; say Math::BigInt->new("716115441142293915.0000000000000000000000")' 71611544114229000003915000000000000000000 $ perl -Iblib/lib -Iblib/arch -E 'use Math::BigInt lib=>"Pari"; say Math::BigInt->new("716115441142293915.0000000000000000000000")' 716115441142293915.000000000000000000000000000000000000000 $ perl -Iblib/lib -Iblib/arch -E 'use Math::BigInt lib=>"GMP"; say Math::BigInt->new("716115441142293915.0000000000000000000000")' 0 Note that neither of the two backends will pass tests so these results aren't too surprising. The old new() would call _new with $$miv, while the new new() calls with the complete input ($wanted). At a first glance, it looks like: if ($sgn) { $self->{value} = $CALC->_new($abs); } else { $self->{value} = $CALC->_new($wanted); } should be: $self->{value} = $CALC->_new($abs); That is, we don't want to pass in the .0* or the e0 or the sign -- just the number. This solves half the failing tests for Math::BigInt::GMP. The other half are because "infinity" is now allowed and they have tests that it is *not* allowed. Changing the two entries in bigintpm.inc and three in bigfltpm.inc combined with the change above makes Math::BigInt::GMP 1.47 pass tests.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-17386-1451503186-1561.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-17386-1451503186-1561.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-20884-1451508920-782.110792-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 111
Download (untitled) / with headers
text/plain 111b
Oh my. This was a nasty bug. I will release a fix as soon as I can, hopefully at the very beginning of January.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-20884-1451508920-782.110792-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-17386-1451503186-1561.0-0-0 [...] rt.cpan.org> <rt-4.0.18-20884-1451508920-782.110792-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-28797-1451521071-66.110792-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 255
Download (untitled) / with headers
text/plain 255b
I have included the fix provided by DANAJ (thanks!) in the newest release, version 1.999713. I guess this bug illustrates that the test suite is not good enough, but at least I have added a few test cases to the file t/bigintpm.inc that catches this bug.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-17386-1451503186-1561.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-17386-1451503186-1561.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-3504-1451993760-1064.110792-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 19
Fixed in v1.999713.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.