Re: [Nolug] In case you wanted to know how big 2 to the 3,000, 000is...

From: Alex McKenzie <alex_at_boxchain.com>
Date: Thu, 1 Jul 2004 14:52:00 -0500 (CDT)
Message-ID: <2275.131.110.98.30.1088711520.squirrel@boxchain.com>

<quote who="Friedrich Gurtler">

> I tried it in perl too, but got rather different results.
>
> use Math::BigInt lib=>'GMP';
> print Math::BigInt->new('1')->blsft(3000000, 2)->length() ."\n";
>
> fritz $ time perl test.pl
> 903090
>
> real 0m10.035s
> user 0m8.320s
> sys 0m0.160s
>
> 10 seconds on a 667 Mhz Mac. It is all about how smart your algorithm
> is. (Or perhaps Macs are that powerful! ;-) )
>

It has to do with the libraries you use. In the php code that was posted,
it was calling a bcmath function, which isn't compiled in by default. The
perl code also uses a similar library (Math::BigInt). The python code was
not using the equivalent function, which is why it took ages.

-- 
Alex McKenzie    alex@boxchain.com     http://boxchain.com
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/01/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST