| Copyright | (c) 2011 Daniel Fischer |
|---|---|
| License | MIT |
| Maintainer | Daniel Fischer <daniel.is.fischer@googlemail.com> |
| Stability | Provisional |
| Portability | Non-portable (GHC extensions) |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
GHC.Integer.Logarithms.Compat
Contents
Description
Low level stuff for integer logarithms.
Synopsis
- integerLogBase# :: Integer -> Integer -> Int#
- integerLog2# :: Integer -> Int#
- wordLog2# :: Word# -> Int#
Functions
integerLogBase# :: Integer -> Integer -> Int# Source #
Calculate the integer logarithm for an arbitrary base.
The base must be greater than 1, the second argument, the number
whose logarithm is sought, shall be positive, otherwise the
result is meaningless.
The following property holds
base ^integerLogBase#base m <= m < base ^(integerLogBase#base m + 1)
for base > 1 and m > 0.
Note: Internally uses integerLog2# for base 2