# README
This is a goinstall-able mirror of modified code already published at: http://git.nic.cz/redmine/projects/gornd/repository
Packages in this repository:
Install: $ go get modernc.org/mathutil Godocs: http://godoc.org/modernc.org/mathutil
Install: $ go get modernc.org/mathutil/mersenne Godocs: http://godoc.org/modernc.org/mathutil/mersenne
# Packages
Package mersenne collects utilities related to Mersenne numbers[1] and/or some
of their properties.
# Functions
AddOverflowInt16 returns a + b and an indication whether the addition overflowed the int16 range.
AddOverflowInt32 returns a + b and an indication whether the addition overflowed the int32 range.
AddOverflowInt64 returns a + b and an indication whether the addition overflowed the int64 range.
AddOverflowInt8 returns a + b and an indication whether the addition overflowed the int8 range.
AddUint128_64 returns the uint128 sum of uint64 a and b.
BinaryLog computes the binary logarithm of n.
BitLen returns the bit width of the non zero part of n.
BitLenByte returns the bit width of the non zero part of n.
BitLenUint returns the bit width of the non zero part of n.
BitLenUint16 returns the bit width of the non zero part of n.
BitLenUint32 returns the bit width of the non zero part of n.
BitLenUint64 returns the bit width of the non zero part of n.
BitLenUintptr returns the bit width of the non zero part of n.
CheckAddInt64 returns the a+b and an indicator that the result is greater than math.MaxInt64.
CheckSubInt64 returns a-b and an indicator that the result is less than than math.MinInt64.
Clamp returns a value restricted between lo and hi.
ClampByte returns a value restricted between lo and hi.
ClampInt16 returns a value restricted between lo and hi.
ClampInt32 returns a value restricted between lo and hi.
ClampInt64 returns a value restricted between lo and hi.
ClampInt8 returns a value restricted between lo and hi.
ClampUint16 returns a value restricted between lo and hi.
ClampUint32 returns a value restricted between lo and hi.
ClampUint64 returns a value restricted between lo and hi.
Envelope is an utility for defining simple curves using a small (usually) set of data points.
FactorInt returns prime factorization of n > 1 or nil otherwise.
GCDByte returns the greatest common divisor of a and b.
GCDUint16 returns the greatest common divisor of a and b.
GCDUint32 returns the greatest common divisor of a and b.
GCDUint64 returns the greatest common divisor of a and b.
IsPrime returns true if n is prime.
IsPrimeUint16 returns true if n is prime.
IsPrimeUint64 returns true if n is prime.
ISqrt returns floor(sqrt(n)).
Log2Byte returns log base 2 of n.
Log2Uint16 returns log base 2 of n.
Log2Uint32 returns log base 2 of n.
Log2Uint64 returns log base 2 of n.
Max returns the larger of a and b.
MaxByte returns the larger of a and b.
MaxBytePtr returns a pointer to the larger of a and b, or nil.
MaxByteVal returns the largest argument passed.
MaxInt16 returns the larger of a and b.
MaxInt16Ptr returns a pointer to the larger of a and b, or nil.
MaxInt16Val returns the largest argument passed.
MaxInt32 returns the larger of a and b.
MaxInt32Ptr returns a pointer to the larger of a and b, or nil.
MaxInt32Val returns the largest argument passed.
MaxInt64 returns the larger of a and b.
MaxInt64Ptr returns a pointer to the larger of a and b, or nil.
MaxInt64Val returns the largest argument passed.
MaxInt8 returns the larger of a and b.
MaxInt8Ptr returns a pointer to the larger of a and b, or nil.
MaxInt8Val returns the largest argument passed.
MaxPtr returns a pointer to the larger of a and b, or nil.
MaxUint16 returns the larger of a and b.
MaxUint16Ptr returns a pointer to the larger of a and b, or nil.
MaxUint16Val returns the largest argument passed.
MaxUint32 returns the larger of a and b.
MaxUint32Ptr returns a pointer to the larger of a and b, or nil.
MaxUint32Val returns the largest argument passed.
MaxUint64 returns the larger of a and b.
MaxUint64Ptr returns a pointer to the larger of a and b, or nil.
MaxUint64Val returns the largest argument passed.
MaxVal returns the largest argument passed.
Min returns the smaller of a and b.
MinByte returns the smaller of a and b.
MinBytePtr returns a pointer to the smaller of a and b, or nil.
MinByteVal returns the smallest argument passed.
MinInt16 returns the smaller of a and b.
MinInt16Ptr returns a pointer to the smaller of a and b, or nil.
MinInt16Val returns the smallest argument passed.
MinInt32 returns the smaller of a and b.
MinInt32Ptr returns a pointer to the smaller of a and b, or nil.
MinInt32Val returns the smallest argument passed.
MinInt64 returns the smaller of a and b.
MinInt64Ptr returns a pointer to the smaller of a and b, or nil.
MinInt64Val returns the smallest argument passed.
MinInt8 returns the smaller of a and b.
MinInt8Ptr returns a pointer to the smaller of a and b, or nil.
MinInt8Val returns the smallest argument passed.
MinPtr returns a pointer to the smaller of a and b, or nil.
MinUint16 returns the smaller of a and b.
MinUint16Ptr returns a pointer to the smaller of a and b, or nil.
MinUint16Val returns the smallest argument passed.
MinUint32 returns the smaller of a and b.
MinUint32Ptr returns a pointer to the smaller of a and b, or nil.
MinUint32Val returns the smallest argument passed.
MinUint64 returns the smaller of a and b.
MinUint64Ptr returns a pointer to the smaller of a and b, or nil.
MinUint64Val returns the smallest argument passed.
MinVal returns the smallest argument passed.
ModPowBigInt computes (b^e)%m.
ModPowByte computes (b^e)%m.
ModPowUint16 computes (b^e)%m.
ModPowUint32 computes (b^e)%m.
ModPowUint64 computes (b^e)%m.
MulOverflowInt16 returns a * b and an indication whether the product overflowed the int16 range.
MulOverflowInt32 returns a * b and an indication whether the product overflowed the int32 range.
MulOverflowInt64 returns a * b and an indication whether the product overflowed the int64 range.
MulOverflowInt8 returns a * b and an indication whether the product overflowed the int8 range.
MulUint128_64 returns the uint128 bit product of uint64 a and b.
NewFC32 returns a newly created FC32 adjusted for the closed interval [lo, hi] or an Error if any.
NewFCBig returns a newly created FCBig adjusted for the closed interval [lo, hi] or an Error if any.
NewInt128FromFloat32 returns a new Int128 value initialized to n.
NewInt128FromFloat64 returns a new Int128 value initialized to n.
NewInt128FromInt64 return a new Int128 value initialized to n.
NewInt128FromUint64 return a new Int128 value initialized to n.
NewUint128FromFloat32 returns a new Uint128 value initialized to n.
NewUint128FromFloat64 returns a new Uint128 value initialized to n.
NewUint128FromInt64 return a new Uint128 value initialized to n.
NewUint128FromUint64 return a new Uint128 value initialized to n.
NextPrime returns first prime > n and true if successful or an undefined value and false if there is no next prime in the uint32 limits.
NextPrimeUint16 returns first prime > n and true if successful or an undefined value and false if there is no next prime in the uint16 limits.
NextPrimeUint64 returns first prime > n and true if successful or an undefined value and false if there is no next prime in the uint64 limits.
PermutationFirst generates the first permutation of data.
PermutationNext generates the next permutation of data if possible and return true.
PopCount returns population count of n (number of bits set in n).
PopCountBigInt returns population count of |n| (number of bits set in |n|).
PopCountByte returns population count of n (number of bits set in n).
PopCountUint returns population count of n (number of bits set in n).
PopCountUint16 returns population count of n (number of bits set in n).
PopCountUint32 returns population count of n (number of bits set in n).
PopCountUint64 returns population count of n (number of bits set in n).
PopCountUintptr returns population count of n (number of bits set in n).
PowerizeBigInt returns (e, p) such that e is the smallest number for which p == b^e is greater or equal n.
PowerizeUint32BigInt returns (e, p) such that e is the smallest number for which p == b^e is greater or equal n.
PrimorialProductsUint32 returns a slice of numbers in [lo, hi] which are a product of max 'max' primorials.
ProbablyPrimeBigInt returns true if n is prime or n is a pseudoprime to base a.
ProbablyPrimeBigInt_32 returns true if n is prime or n is a pseudoprime to base a.
ProbablyPrimeUint32 returns true if n is prime or n is a pseudoprime to base a.
ProbablyPrimeUint64_32 returns true if n is prime or n is a pseudoprime to base a.
QCmpUint32 compares a/b and c/d and returns:
-1 if a/b < c/d 0 if a/b == c/d +1 if a/b > c/d.
QScaleUint32 returns a such that a/b >= c/d.
QuadPolyDiscriminant returns the discriminant of a quadratic polynomial in one variable of the form a*x^2+b*x+c with integer coefficients a, b, c, or an error on overflow.
QuadPolyDiscriminantBig returns the discriminant of a quadratic polynomial in one variable of the form a*x^2+b*x+c with integer coefficients a, b, c.
QuadPolyFactors returns the content and the irreducible factors of the primitive part of a quadratic polynomial in one variable with integer coefficients a, b, c of the form a*x^2+b*x+c in integers, or an error on overflow.
QuadPolyFactorsBig returns the content and the irreducible factors of the primitive part of a quadratic polynomial in one variable with integer coefficients a, b, c of the form a*x^2+b*x+c in integers.
SqrtBig returns floor(sqrt(n)).
SqrtUint64 returns floor(sqrt(n)).
SubOverflowInt16 returns a - b and an indication whether the subtraction overflowed the int16 range.
SubOverflowInt32 returns a - b and an indication whether the subtraction overflowed the int32 range.
SubOverflowInt64 returns a - b and an indication whether the subtraction overflowed the int64 range.
SubOverflowInt8 returns a - b and an indication whether the subtraction overflowed the int8 range.
ToBase produces n in base b.
UClamp returns a value restricted between lo and hi.
UintptrBits returns the bit width of an uintptr at the executing machine.
UMax returns the larger of a and b.
UMaxPtr returns a pointer to the larger of a and b, or nil.
UMaxVal returns the largest argument passed.
UMin returns the smaller of a and b.
UMinPtr returns a pointer to the smaller of a and b, or nil.
UMinVal returns the smallest argument passed.
# Constants
Architecture and/or implementation specific integer limits and bit widths.
As named.
Architecture and/or implementation specific integer limits and bit widths.
Architecture and/or implementation specific integer limits and bit widths.
Architecture and/or implementation specific integer limits and bit widths.
Smooth for all derivations.
Architecture and/or implementation specific integer limits and bit widths.
# Variables
MaxInt128 represents the maximun Int128 value as big.Int.
MaxUint128 represents the maximun Uint128 value as big.Int.
MinInt128 represents the minimun Int128 value as big.Int.
# Structs
FactorTerm is one term of an integer factorization.
FC32 is a full cycle PRNG covering the 32 bit signed integer range.
FCBig is a full cycle PRNG covering ranges outside of the int32 limits.
Int128 is an 128 bit signed integer.
PolyFactor describes an irreducible factor of a polynomial in one variable with integer coefficients P, Q of the form P*x+Q.
PolyFactorBig describes an irreducible factor of a polynomial in one variable with integer coefficients P, Q of the form P*x+Q.
Uint128 is an 128 bit unsigned integer.
# Type aliases
Approximation type determines approximation methods used by e.g.
FactorTerms represent a factorization of an integer.