[Haskell] for large x, log (x::Integer) :: Double

Ronny Wichers Schreur ronny at cs.kun.nl
Mon Jul 12 10:29:22 EDT 2004

Edmund GRIMLEY EVANS asks (to the Haskell mailing list):

> Does Haskell provide any means of determining the number of
> binary digits in an Integer other than by repeated division?

Dylan Thurston answers:

> See the Data.Bits library:
> http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data.Bits.html

This library will let you use a shift instead of a division,
but won't give you a constant time size function for Integers.


Ronny Wichers Schreur

More information about the Haskell mailing list