[Haskell-cafe] faster factorial function via FFI?

Bryan O'Sullivan bos at serpentine.com
Mon Apr 23 19:36:14 EDT 2007

Dan Drake wrote:

> This is combinatorics, so I can't just say "oh, this is small" and cross
> it off like physicists do. :)

Binary splitting is much faster than the naive approach, but still easy 
to understand.  That's fac1 in the attached file.

I ran out of time to write an efficient implementation using swing 
numbers, but my slow, crummy version is present as fac2, just as a data 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fact.hs
Type: text/x-haskell
Size: 1674 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070423/50ad3a72/Fact.bin

More information about the Haskell-Cafe mailing list