Integer package:integer-logarithms

Deprecated: It is no faster than (^)
Integer logarithms. Math.NumberTheory.Logarithms and Math.NumberTheory.Powers.Integer from the arithmoi package. Also provides GHC.Integer.Logarithms.Compat and Math.NumberTheory.Power.Natural modules, as well as some additional functions in migrated modules.
Calculate the integer logarithm of an Integer to base 10. The argument must be positive, otherwise an error is thrown.
Same as integerLog10, but without a check for a positive argument. Saves a little time when called often for known good input.
Calculate the integer logarithm of an Integer to base 2. The argument must be positive, otherwise an error is thrown.
Same as integerLog2, but without checks, saves a little time when called often for known good input.
Calculate the integer logarithm for an arbitrary base. The base must be greater than 1, the second argument, the number whose logarithm is sought, must be positive, otherwise an error is thrown. If base == 2, the specialised version is called, which is more efficient than the general algorithm. Satisfies:
base ^ integerLogBase base m <= m < base ^ (integerLogBase base m + 1)
for base > 1 and m > 0.
Same as integerLogBase, but without checks, saves a little time when called often for known good input.
Power of an Integer by the left-to-right repeated squaring algorithm. This needs two multiplications in each step while the right-to-left algorithm needs only one multiplication for 0-bits, but here the two factors always have approximately the same size, which on average gains a bit when the result is large. For small results, it is unlikely to be any faster than (^), quite possibly slower (though the difference shouldn't be large), and for exponents with few bits set, the same holds. But for exponents with many bits set, the speedup can be significant. Warning: No check for the negativity of the exponent is performed, a negative exponent is interpreted as a large positive exponent.
Same as integerPower, but for exponents of type Word.