in reply to bin2dec for big numbers
You may be able to get rather better speed with some simplistic string manipulation. Consider:
sub mul2 { my($str, $add) = @_; (my $carry = $str) =~ tr/0-9/0000011111/; (my $str2 = "0$str") =~ tr/0-9/0246802468/; my $result = $str2 | "$carry$add"; $result =~ s/^0//; $result; }
Hugo
|
|---|