Skip Menu |
 

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

Report information
The Basics
Id: 12849
Status: resolved
Worked: 8 min
Priority: 0/
Queue: Math-BigInt

People
Owner: TELS [...] cpan.org
Requestors: jameshippisley [...] yahoo.com
Cc:
AdminCc:

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



Subject: bdiv using Math::BigInt::Calc gives incorrect value
Download (untitled) / with headers
text/plain 851b
Hi! The following code shows $a->bdiv($b) yielding 1 when $a<$b. The same code works fine when I do "use Math::BigInt lib => 'GMP'". #!/usr/local/bin/perl5.8.6 use Math::BigInt; foreach ("","::Calc") { my $pkg = "Math::BigInt$_\::VERSION"; print "$pkg version is ", ${$pkg},"\n"; } foreach my $i (0..100) { my $pow2 = new Math::BigInt(2)->bpow($i); my $pow2sub1 = $pow2->copy->bdec; my $ratio = $pow2sub1->copy->bdiv($pow2); $ratio != 0 and die "ERROR: (2^$i-1)/(2^$i) computed as $ratio\n"; } output... Math::BigInt::VERSION version is 1.76 Math::BigInt::Calc::VERSION version is 0.46 ERROR: (2^24-1)/(2^24) computed as 1 I am using a recently installed perl5.8.6 built on a machine running rh linux 7.2. I am seeing similar (presumably related) effects with brsft on large numbers. Any assistance appreciated! Thanks, James
Download (untitled) / with headers
text/plain 351b
[guest - Mon May 16 20:39:46 2005]: Show quoted text
> Hi! > > The following code shows $a->bdiv($b) yielding 1 when $a<$b. The same > code works fine when I do "use Math::BigInt lib => 'GMP'". >
Moin, I can recreate the problem on my machine using Perl 5.8.6 and Math::BigInt v1.76. I'll try to debug this and post an update ASAP. Thanx for the report! Tels
Download (untitled) / with headers
text/plain 176b
That bug should now be fixed in v1.77 - the shortcut in Calc for dividing numbers of the same lenght was simple wrong. I removed it and added a testcase. Thanx for your report!


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.