Yes, I suspect you are right. I didn't look into that in much detail, although I did try exchanging "(2 ^ 50000000)" with "(1 `shiftL` 50000000)"; but that didn't make any difference.

Uwe

On Fri, Feb 15, 2008 at 9:21 AM, Ryan Ingram <ryani.spam@gmail.com> wrote:
On Thu, Feb 14, 2008 at 8:23 PM, Uwe Hollerbach <uhollerbach@gmail.com> wrote:
>  Stefan's routine is, as expected, much much faster still: I tested the
>  first two routines on numbers with 5 million or so bits and they took
>  ~20 seconds of CPU time, whereas I tested Stefan's routine with
>  numbers with 50 million bits, and it took ~11 seconds of CPU time.

This seems wrong to me; that routine should take a small constant
amount of time.  I suspect you are measuring the time to construct the
50-million bit numbers as well.  If you constructed a single number
and called this routine on it several times I am sure you would get
far different results, with the first routines taking ~7-11s each and
Stefan's GHC/GMP-magic taking almost nothing.

 -- ryan