Subject: | bug incrementing |
Date: | Thu, 9 Jan 2020 00:42:22 +0200 |
To: | bug-bignum [...] rt.cpan.org |
From: | andreashad2 <andreashad2 [...] googlemail.com> |
PLEASE see https://perlmonks.org/?node_id=11110997
for how this started and reported.
both of these fail with an infinite loop printing i=10 on linux fedora
30, perl 5.28.2. 10 and 15 are the min numbers to do this.
use bignum (p=>1);
for(my $i = 1;$i->blt(15);$i->binc()){
print "i=$i\n";
}
for(my $i = 1;$i<=10;$i++){
print "i=$i\n";
}
this shows to me that it is not the loop or the overloaded increment but
that when p=>1 it thinks that it's adding that value divided by 10 or
something
my $i = 10;
print "1 i=$i\n";
$i++;
print "2 i=$i\n";
$i = $i + 1;
print "3 i=$i\n";
$i = $i + 2;
print "4 i=$i\n";
$i = $i + 3;
print "5 i=$i\n";
$i = $i + 4;
print "6 i=$i\n";
$i = $i + 5;
print "7 i=$i\n";
$i = $i + 6 ;
print "8 i=$i\n";
prints:
1 i=10
2 i=10
3 i=10
4 i=10
5 i=10
6 i=10
7 i=20
8 i=30
PLEASE see
both of these fail with an infinite loop printing i=10 on linux fedora
30, perl 5.28.2. 10 and 15 are the min numbers to do this.
use bignum (p=>1);
for(my $i = 1;$i->blt(15);$i->binc()){
print "i=$i\n";
}
for(my $i = 1;$i<=10;$i++){
print "i=$i\n";
}
this shows to me that it is not the loop or the overloaded increment but
that when p=>1 it thinks that it's adding that value divided by 10 or
something
my $i = 10;
print "1 i=$i\n";
$i++;
print "2 i=$i\n";
$i = $i + 1;
print "3 i=$i\n";
$i = $i + 2;
print "4 i=$i\n";
$i = $i + 3;
print "5 i=$i\n";
$i = $i + 4;
print "6 i=$i\n";
$i = $i + 5;
print "7 i=$i\n";
$i = $i + 6 ;
print "8 i=$i\n";
prints:
1 i=10
2 i=10
3 i=10
4 i=10
5 i=10
6 i=10
7 i=20
8 i=30
PLEASE see https://perlmonks.org/?node_id=11110997
for how this started and reported.
bw, bliako@cpan.org