Safe Haskell | None |
---|---|
Language | Haskell2010 |
The IntegerLog module provides a fast integer logarithm in base 2. Current implementation relies in the integer-gmp package.
Synopsis
- integerLog2 :: Integer -> Int
Documentation
integerLog2 :: Integer -> Int Source #
The integerLog2
function gives the floor of the logarithm of a positive integer. For non-positive arguments the returned result is meaningless. Possible overflow of returned value is ignored.
It could be argued that NegInf should be returned for 0 if the return type had been Extended
Int
.