[Haskell-cafe] Looking for smallest power of 2 >= Integer

David Benbennick dbenbenn at gmail.com
Tue Dec 4 13:08:47 EST 2007


On Dec 4, 2007 9:21 AM, Steven Fodstad <flarelocke at hotpop.com> wrote:
> For the index, how about this:
>
> truncate  . (/(log 2)) . log . fromIntegral

That will not work.  It will convert the Integer to Double, which will
overflow if the Integer is very large.


More information about the Haskell-Cafe mailing list