in reply to bigint - float?

You can get what you want directly, without log(), using some bit-twiddling:

my $the_num = Math::BigInt->new(1234567890123545678); sub numbits { my $tester = Math::BigInt->new(shift); my $i = 0; do {$i++} while ($tester >>= 1); $i; } print numbits($the_num);

After Compline,
Zaxo

Replies are listed 'Best First'.
good idea, but is it fast?
by jhanna (Scribe) on Nov 24, 2001 at 04:06 UTC
    Hmm... I like the idea. It replaces a series of complex string operations with a simple loop. I'll have to run some benchmarks to see which is faster. But I do like this approach.