/** * Check if value is a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/is) * @param x a value * @returns is bigint? */ declare function is(x: any): x is bigint; /** * Compare two bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/compare) * @param x a bigint * @param y another bigint * @returns xy: +ve */ declare function compare(x: bigint, y: bigint): number; /** * Get the absolute of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/abs) * @param x a bigint * @returns |x| */ declare function abs(x: bigint): bigint; /** * Get the sign of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/sign) * @param x a bigint * @returns x>0: 1n, x<0: -1n, x=0: 0n */ declare function sign(x: bigint): bigint; /** * Perform floor-divison of two bigints (\\). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/floorDiv) * @param x dividend * @param y divisor * @returns โŒŠx/yโŒ‹ */ declare function floorDiv(x: bigint, y: bigint): bigint; /** * Perform ceiling-divison of two bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/ceilDiv) * @param x dividend * @param y divisor * @returns โŒˆx/yโŒ‰ */ declare function ceilDiv(x: bigint, y: bigint): bigint; /** * Perform rounded-divison of two bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/roundDiv) * @param x divisor * @param y dividend * @returns [x/y] */ declare function roundDiv(x: bigint, y: bigint): bigint; /** * Find the remainder of x/y with sign of x (truncated division). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/rem) * @param x dividend * @param y divisor * @returns trunc(x % y) */ declare function rem(x: bigint, y: bigint): bigint; /** * Find the remainder of x/y with sign of y (floored division). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/mod) * @param x dividend * @param y divisor * @returns floor(x % y) */ declare function mod(x: bigint, y: bigint): bigint; /** * Find the remainder of x/y with +ve sign (euclidean division). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/modp) * @param x dividend * @param y divisor * @returns x/y>0: floor(x % y), x/y<0: ceil(x % y) */ declare function modp(x: bigint, y: bigint): bigint; /** * Constrain a bigint within a minimum and a maximum value. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/constrain) * @param x a bigint * @param minv minimum value * @param maxv maximum value * @returns xmax: max, x */ declare function constrain(x: bigint, minv: bigint, maxv: bigint): bigint; /** * Re-map a bigint from one range to another. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/remap) * @param x a bigint * @param r lower bound of current range * @param R upper bound of current range * @param t lower bound of target range * @param T upper bound of target range * @returns โˆˆ [ymin, ymax] */ declare function remap(x: bigint, r: bigint, R: bigint, t: bigint, T: bigint): bigint; /** * Linearly interpolate a bigint between two bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/lerp) * @param x start bigint * @param y stop bigint * @param t interpolant โˆˆ [0, 1] * @returns โˆˆ [x, y] */ declare function lerp(x: bigint, y: bigint, t: number): bigint; /** * Check if bigint is a power-of-2. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/isPow2) * @param x a bigint * @returns 2โฑ = x? | i = +ve integer */ declare function isPow2(x: bigint): boolean; /** * Check if bigint is a power-of-10. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/isPow10) * @param x a bigint * @returns 10โฑ = x? | i = +ve integer */ declare function isPow10(x: bigint): boolean; /** * Find largest power-of-2 less than or equal to given bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/prevPow2) * @param x a bigint * @returns 2โฑ | 2โฑ โ‰ค x and 2โฑ > x/2 */ declare function prevPow2(x: bigint): bigint; /** * Find largest power-of-10 less than or equal to given bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/prevPow10) * @param x a bigint * @returns 10โฑ | 10โฑ โ‰ค x and 10โฑ > x/10 */ declare function prevPow10(x: bigint): bigint; /** * Find smallest power-of-2 greater than or equal to given bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/nextPow2) * @param x a bigint * @returns 2โฑ | 2โฑ โ‰ฅ x and 2โฑ < 2x */ declare function nextPow2(x: bigint): bigint; /** * Find smallest power-of-10 greater than or equal to given bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/nextPow10) * @param x a bigint * @returns 10โฑ | 10โฑ โ‰ฅ x and 10โฑ < 10x */ declare function nextPow10(x: bigint): bigint; /** * Find the base-2 logarithm of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/log2) * @param x a bigint * @returns logโ‚‚(x) */ declare function log2(x: bigint): bigint; /** * Find the base-10 logarithm of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/log10) * @param x a bigint * @returns logโ‚โ‚€(x) */ declare function log10(x: bigint): bigint; /** * Find the square root of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/sqrt) * @param x a bigint * @returns โˆšx */ declare function sqrt(x: bigint): bigint; /** * Find the cube root of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/cbrt) * @param x a bigint * @returns ยณโˆšx */ declare function cbrt(x: bigint): bigint; /** * Find the nth root of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/root) * @param x a bigint * @param n nth root (1n) * @returns โฟโˆšx */ declare function root(x: bigint, n?: bigint): bigint; /** * List all divisors of a bigint, except itself. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/properDivisors) * @param x a bigint * @returns proper divisors (factors) */ declare function properDivisors(x: bigint): bigint[]; /** * Sum all proper divisors of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/aliquotSum) * @param x a bigint * @returns ฮฃdแตข | dแตข is a divisor of x and โ‰ x */ declare function aliquotSum(x: bigint): bigint; /** * Find the least prime number which divides a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/minPrimeFactor) * @param x a bigint * @returns least prime factor */ declare function minPrimeFactor(x: bigint): bigint; /** * Find the greatest prime number which divides a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/maxPrimeFactor) * @param x a bigint * @returns greatest prime factor */ declare function maxPrimeFactor(x: bigint): bigint; /** * Find the prime factors of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/primeFactors) * @param x a bigint * @returns [fโ‚€, fโ‚, ...] | fแตข divides x and is prime */ declare function primeFactors(x: bigint): bigint[]; /** * Find the prime factors and respective exponents of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/primeExponentials) * @param x a bigint * @returns [[fโ‚€, eโ‚€], [fโ‚, eโ‚], ...] | fแตข is a prime factor of x and eแตข is its exponent */ declare function primeExponentials(x: bigint): [bigint, bigint][]; /** * Check if bigint is prime. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/isPrime) * @param x a bigint * @returns is divisible by 1n and itself only? */ declare function isPrime(x: bigint): boolean; /** * Find the greatest common divisor of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/gcd) * @param xs a list of bigints * @returns gcd(xโ‚, xโ‚‚, ...) */ declare function gcd(...xs: bigint[]): bigint; /** * Find the least common multiple of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/lcm) * @param xs a list of bigints * @returns lcm(xโ‚, xโ‚‚, ...) */ declare function lcm(...xs: bigint[]): bigint; /** * Find the factorial of a bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/factorial) * @param n a bigint * @param k denominator factorial [0] * @returns P(n, k); k=0: n!, k>0: n!/k! */ declare function factorial(n: bigint, k?: bigint): bigint; /** * Find the number of ways to choose k elements from a set of n elements. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/binomial) * @param n elements in source set * @param k elements in choose set * @returns C(n, k) */ declare function binomial(n: bigint, k: bigint): bigint; /** * Find the number of ways to put n objects in m bins (n=sum(kแตข)). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/multinomial) * @param ks objects per bin (kแตข) * @returns n!/(kโ‚!kโ‚‚!...) | n=sum(kแตข) */ declare function multinomial(...ks: bigint[]): bigint; /** * Find the length of hypotenuse. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/hypot) * @param xs lengths of perpendicular sides (x, y, z, ...) * @returns โˆš(xยฒ + yยฒ + zยฒ) */ declare function hypot(...xs: bigint[]): bigint; /** * Find the sum of bigints (ฮฃ). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/sum) * @param xs bigints * @returns ฮฃxแตข */ declare function sum(...xs: bigint[]): bigint; /** * Find the product of bigints (โˆ). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/product) * @param xs bigints * @returns โˆxแตข */ declare function product(...xs: bigint[]): bigint; /** * Find the value separating the higher and lower halves of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/median) * @param xs a list of bigints * @returns xโ‚˜ | sort(xs) = [..., xโ‚˜, ...] */ declare function median(...xs: bigint[]): bigint; /** * Find the values that appear most often. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/modes) * @param xs a list of bigints * @returns [xโ‚˜โ‚, xโ‚˜โ‚‚, ...] | count(xโ‚˜แตข) โ‰ฅ count(xแตข) โˆ€ xแตข โˆˆ xs */ declare function modes(...xs: bigint[]): bigint[]; /** * Find the smallest bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/min) * @param xs bigints * @returns min(xs) */ declare function min(...xs: bigint[]): bigint; /** * Find the largest bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/max) * @param xs bigints * @returns max(xs) */ declare function max(...xs: bigint[]): bigint; /** * Find the minimum and maximum bigint. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/range) * @param xs bigints * @returns [min, max] */ declare function range(...xs: bigint[]): [bigint, bigint]; /** * Find the mean of squared deviation of bigints from its mean. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/variance) * @param xs a list of bigints * @returns ฯƒยฒ = E[(xs - ยต)ยฒ] | ยต = mean(xs) */ declare function variance(...xs: bigint[]): bigint; /** * Find the arithmetic mean of bigints (ยต). * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/arithmeticMean) * @param xs bigints * @returns ยต = (ฮฃxแตข)/n | n = size(xs) */ declare function arithmeticMean(...xs: bigint[]): bigint; /** * Find the geometric mean of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/geometricMean) * @param xs bigints * @returns โฟโˆš(โˆxแตข) | n = size(xs) */ declare function geometricMean(...xs: bigint[]): bigint; /** * Find the harmonic mean of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/harmonicMean) * @param xs bigints * @returns n/ฮฃ(1/xแตข) | n = size(xs) */ declare function harmonicMean(...xs: bigint[]): bigint; /** * Find the quadriatic mean of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/quadriaticMean) * @param xs bigints * @returns โˆš(ฮฃxแตขยฒ)/n | n = size(xs) */ declare function quadriaticMean(...xs: bigint[]): bigint; /** * Find the cubic mean of bigints. * [๐Ÿ“˜](https://github.com/nodef/extra-bigint/wiki/cubicMean) * @param xs bigints * @returns ยณโˆš(ฮฃxแตขยณ)/n | n = size(xs) */ declare function cubicMean(...xs: bigint[]): bigint; export { abs, properDivisors as aliquotParts, aliquotSum, arithmeticMean, binomial, cbrt, ceilDiv, constrain as clamp, compare, constrain, cubicMean, factorial, floorDiv, gcd, geometricMean, maxPrimeFactor as greatestPrimeFactor, harmonicMean, gcd as hcf, hypot, is, isPow10, isPow2, isPrime, lcm, minPrimeFactor as leastPrimeFactor, lerp, log10, log2, remap as map, max, maxPrimeFactor, arithmeticMean as mean, median, min, minPrimeFactor, mod, modes, modp, multinomial, nextPow10, nextPow2, prevPow10, prevPow2, primeExponentials, primeFactors, product, properDivisors, quadriaticMean, range, rem, remap, root, quadriaticMean as rootMeanSquare, roundDiv, sign, sqrt, sum, variance };