in reply to Re^4: Why am I losing accuracy?
in thread Why am I losing accuracy?
I don't mean to put pressure - I just leave this here for anyone.
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";
1 i=10 2 i=10 3 i=10 4 i=10 5 i=10 6 i=10 7 i=20 8 i=30
I have filed a bug to bigint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Why am I losing accuracy?
by bliako (Abbot) on Jan 11, 2020 at 12:07 UTC | |
by bliako (Abbot) on Jan 12, 2020 at 11:31 UTC | |
by haukex (Archbishop) on Jan 12, 2020 at 15:08 UTC | |
by roboticus (Chancellor) on Jan 12, 2020 at 15:56 UTC | |
by bliako (Abbot) on Jan 12, 2020 at 19:47 UTC | |
|