Integer package:integer-gmp

The Integer type. This module exposes the portable Integer API. See GHC.Integer.GMP.Internals for the integer-gmp-specific internal representation of Integer as well as optimized GMP-specific operations.
Arbitrary precision integers. In contrast with fixed-size integral types such as Int, the Integer type represents the entire infinite range of integers. For more information about this type's representation, see the comments in its implementation.
Integer library based on GMP This package provides the low-level implementation of the standard Integer type based on the GNU Multiple Precision Arithmetic Library (GMP). This package provides access to the internal representation of Integer as well as primitive operations with no proper error handling, and should only be used directly with the utmost care.
Truncates Integer to least-significant Int#
Calculate the integer base 2 logarithm of an Integer. The calculation is more efficient than for the general case, on platforms with 32- or 64-bit words much more efficient. The argument must be strictly positive, that condition is not checked.
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
Extended version of integerLog2# Assumption: Integer is strictly positive First component of result is log2 n, second is 0# iff n is a power of two.
Compute absolute value of an Integer
Bitwise AND operation
Integer for which only n-th bit is set. Undefined behaviour for negative n values.
Bitwise NOT operation
Simultaneous divInteger and modInteger. Divisor must be non-zero otherwise the GHC runtime will terminate with a division-by-zero fault.