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.
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.
Oh my. This was a nasty bug. I will release a fix as soon as I can, hopefully at the very beginning of January.
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.
Fixed in v1.999713.