in reply to Re: Converting an array of bytes into a BigInt - speed considerations
in thread Converting an array of bytes into a BigInt - speed considerations

Does it give the proper results? As in the old version I'm using, blsft() appears to return a string not a bigint object, $result += $tmp; might not do the proper thing.
use Math::BigInt; use Data::Dumper; print Dumper +Math::BigInt->new(1)->blsft(8); print $Math::BigInt::VERSION;
Result:
$VAR1 = '+256'; 0.01
OTOH, $tmp is a bigint object. Hmm...

OK, no reason to panic:

$result = 1; $result += new Math::BigInt('1234567890' x 10);
does seem to work alright.

Replies are listed 'Best First'.
Re: Re: Re: Converting an array of bytes into a BigInt - speed considerations
by jmcnamara (Monsignor) on Jan 23, 2003 at 14:05 UTC

    It does give the correct results. Give me some credit. ;-)

    I've updated the above benchmark to include the test that I removed before posting.

    I'd agree that the Math::BigInt objects behave a little bit counter-intuitively.

    --
    John.