not sure if it's better or worse, but I'd change that toforeach my $i( reverse 1..$len){ my $x = 10 * $a[$i-1] + $q * $i; $a[$i-1] = $x % (2 * $i - 1); $q = int($x / (2 * $i - 1)); }
not for efficiency, but for (perhaps) easier understandingforeach my $i( reverse 0 .. $len-1){ my $x = 10 * $a[$i] + $q * ($i+1); my $divisor = 2 * $i + 1; $a[$i] = $x % $divisor; $q = int($x / $divisor); }
In reply to Re^3: porting C code to Perl -- solved
by soonix
in thread porting C code to Perl
by Discipulus
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |