extra-number
Version:
A collection for common number functions (queries, comparisons, rounding, divisors, etc).<br>
1,025 lines (1,024 loc) • 23.6 kB
TypeScript
/** Classification of floating point numbers. */ export declare enum FloatClass {
/** Number is zero. */ ZERO = 0x00,
/** Number is subnormal (denormal). */ SUBNORMAL = 0x10,
/** Number is normal. */ NORMAL = 0x20,
/** Number is infinite. */ INFINITE = 0x30,
/** Number is NaN (not a number). */ NAN = 0x40
}
/** Smallest normal (not subnormal) 64-bit floating point number. */ export declare const MIN_NORMAL: 2.2250738585072014e-308;
/** Ratio of a circle's circumference to its diameter. */ export declare const TAU: any;
/**
* Check if value is a number.
* @param v a value
* @returns is number?
* @example
* ```ts
* xnumber.is(3.14);
* // → true
*
* xnumber.is(NaN);
* // → true (an unexpressable number)
*
* xnumber.is('3.14');
* // → false
*
* xnumber.is({'value': 3.14});
* // → false
*
* xnumber.is(null);
* // → false
* ```
*/ export declare function is(v: unknown): v is number;
/**
* Check if number is normal (not zero, subnormal, infinite, or NaN).
* @param x a number
* @returns is normal number?
* @example
* ```ts
* xnumber.isNormal(3.14);
* // → true
*
* xnumber.isNormal(0);
* // → false
*
* xnumber.isNormal(1e-320);
* // → false
*
* xnumber.isNormal(Infinity);
* // → false
*/ export declare function isNormal(x: number): boolean;
/**
* Classify a number into its floating point category.
* @param x a number
* @returns floating point class of `x`
* @example
* ```ts
* xnumber.classify(0);
* // → FloatClass.ZERO
*
* xnumber.classify(1e-320);
* // → FloatClass.SUBNORMAL
*
* xnumber.classify(3.14);
* // → FloatClass.NORMAL
*
* xnumber.classify(Infinity);
* // → FloatClass.INFINITE
*
* xnumber.classify(NaN);
* // → FloatClass.NAN
*/ export declare function classify(x: number): FloatClass;
/**
* Examine if sum of divisors equals the number itself.
* @param x a number
* @returns sum of divisors(x) excluding x = x?
* @example
* ```ts
* xnumber.isPerfect(6);
* // → true (1+2+3=6)
*
* xnumber.isPerfect(28);
* // → true (1+2+4+7+14=28)
*
* xnumber.isPerfect(12);
* // → false (1+2+3+4+6=16)
*
* xnumber.isPerfect(1);
* // → false (no proper divisors)
* ```
*/ export declare function isPerfect(x: number): boolean;
/**
* Examine if sum of divisors exceeds the number itself.
* @param x a number
* @returns sum of divisors(x) excluding x > x?
* @example
* ```ts
* xnumber.isAbundant(8);
* // → false (1+2+4=7 < 8)
*
* xnumber.isAbundant(15);
* // → false (1+3+5=9 < 15)
*
* xnumber.isAbundant(12);
* // → true (1+2+3+4+6=16 > 12)
*
* xnumber.isAbundant(6);
* // → false (1+2+3=6 = 6)
* ```
*/ export declare function isAbundant(x: number): boolean;
export { isAbundant as isExcessive };
/**
* Obtain the sum of divisors exceeding the number itself.
* @param x a number
* @returns sum of divisors(x) excluding x - x
* @example
* ```ts
* xnumber.abundance(12);
* // → 4 (1+2+3+4+6=16; 16-12=4)
*
* xnumber.abundance(15);
* // → -6 (1+3+5=9; 9-15=-6)
* ```
*/ export declare function abundance(x: number): number;
/**
* Obtain the ratio of sum of divisors to the number itself.
* @param x a number
* @returns (sum of divisors(x)) / x
* @example
* ```ts
* xnumber.abundancyIndex(12);
* // → 2.3333... (1+2+3+4+6+12=28; 28/12=7/3)
*
* xnumber.abundancyIndex(15);
* // → 1.6 (1+3+5+15=24; 24/15=8/5)
* ```
*/ export declare function abundancyIndex(x: number): number;
/**
* Count the number of significant digits in a number.
* @param x a number
* @returns |m - '.'| | x = m × 10ᵉ; m = mantissa, e = exponent
* @example
* ```ts
* xnumber.significantDigits(0.0034);
* // → 2
*
* xnumber.significantDigits(120.5e50);
* // → 4
*
* xnumber.significantDigits(120.5e-50);
* // → 4
* ```
*/ export declare function significantDigits(x: number): number;
/**
* Compare two numbers.
* @param x a number
* @param y another number
* @returns x<y: -ve, x=y: 0, x>y: +ve
* @example
* ```ts
* xnumber.compare(10, 12);
* // → -2 (-ve)
*
* xnumber.compare(12, 12);
* // → 0
*
* xnumber.compare(17, 12);
* // → 5 (+ve)
* ```
*/ export declare function compare(x: number, y: number): number;
/**
* Check if two numbers are unordered (NaN involved).
* @param x a number
* @param y another number
* @returns x=NaN or y=NaN?
* @example
* ```ts
* xnumber.isUnordered(10, NaN);
* // → true
*
* xnumber.isUnordered(NaN, 12);
* // → true
*
* xnumber.isUnordered(10, 12);
* // → false
*
* xnumber.isUnordered(NaN, NaN);
* // → true
* ```
*/ export declare function isUnordered(x: number, y: number): boolean;
/**
* Copy the sign of a number to another number.
* @param mag number whose magnitude is to be copied
* @param sgn sign of the number to copy
* @returns `|mag|` with sign of `sgn`
* @example
* ```ts
* xnumber.copySign(3.14, -1);
* // → -3.14
*
* xnumber.copySign(-3.14, 1);
* // → 3.14
*
* xnumber.copySign(-6.28, -1);
* // → -6.28
*/ export declare function copySign(mag: number, sgn: number): number;
/**
* Round down a number to specific precision.
* @param x a number
* @param pre to precision [1]
* @example
* ```ts
* xnumber.floor(9.161, 1);
* // → 9
*
* xnumber.floor(9.161, 0.01);
* // → 9.16
*
* xnumber.floor(9.1617, 0.05);
* // → 9.15
* ```
*/ export declare function floor(x: number, pre?: number): number;
/**
* Round up a number to specific precision.
* @param x a number
* @param pre to precision [1]
* @example
* ```ts
* xnumber.ceil(9.121, 1);
* // → 10
*
* xnumber.ceil(9.121, 0.01);
* // → 9.13
*
* xnumber.ceil(9.1217, 0.05);
* // → 9.15
* ```
*/ export declare function ceil(x: number, pre?: number): number;
/**
* Round a number to specific precision.
* @param x a number
* @param pre to precision [1]
* @example
* ```ts
* xnumber.round(9.135, 1);
* // → 9
*
* xnumber.round(9.135, 1e-2);
* // → 9.14
*
* xnumber.round(9.1357, 0.05);
* // → 9.15
*
* 0.1 + 0.2
* // → 0.30000000000000004 (why?)
*
* xnumber.round(0.1 + 0.2, 1e-12);
* // → 0.3 (nice!)
* ```
*/ export declare function round(x: number, pre?: number): number;
/**
* Perform floor-divison of two numbers.
* @param x divisor
* @param y dividend
* @returns ⌊x/y⌋
* @example
* ```ts
* xnumber.floorDiv(15, 4);
* // → 3
*
* xnumber.floorDiv(2, 2);
* // → 1
*
* xnumber.floorDiv(-15, 4);
* // → -4
* ```
*/ export declare function floorDiv(x: number, y: number): number;
/**
* Perform ceiling-divison of two numbers.
* @param x divisor
* @param y dividend
* @returns ⌈x/y⌉
* @example
* ```ts
* xnumber.ceilDiv(15, 4);
* // → 4
*
* xnumber.ceilDiv(2, 2);
* // → 1
*
* xnumber.ceilDiv(-15, 4);
* // → -3
* ```
*/ export declare function ceilDiv(x: number, y: number): number;
/**
* Perform rounded-divison of two numbers.
* @param x divisor
* @param y dividend
* @returns [x/y]
* @example
* ```ts
* xnumber.roundDiv(15, 4);
* // → 4
*
* xnumber.roundDiv(2, 2);
* // → 1
*
* xnumber.roundDiv(-15, 4);
* // → -4
* ```
*/ export declare function roundDiv(x: number, y: number): number;
/**
* Find the remainder of x/y with sign of x (truncated division).
* @param x dividend
* @param y divisor
* @returns trunc(x % y)
* @example
* ```ts
* xnumber.rem(1, 10);
* // → 1
*
* xnumber.rem(-1, 10);
* // → -1
*
* xnumber.rem(1, -10);
* // → 1
* ```
*/ export declare function rem(x: number, y: number): number;
/**
* Find the remainder of x/y with sign of y (floored division).
* @param x dividend
* @param y divisor
* @returns floor(x % y)
* @example
* ```ts
* xnumber.mod(1, 10);
* // → 1
*
* xnumber.mod(-1, 10);
* // → 9
*
* xnumber.mod(1, -10);
* // → -9
* ```
*/ export declare function mod(x: number, y: number): number;
/**
* Find the remainder of x/y with +ve sign (euclidean division).
* @param x dividend
* @param y divisor
* @returns n>0: floor(x % y), n<0: ceil(x % y)
* @example
* ```ts
* xnumber.modp(1, 10);
* // → 1
*
* xnumber.modp(-1, 10);
* // → 9
*
* xnumber.modp(1, -10);
* // → 1
* ```
*/ export declare function modp(x: number, y: number): number;
/**
* Constrain a number within a minimum and a maximum value.
* @param x a number
* @param min minimum value
* @param max maximum value
* @returns x<min: min, x>max: max, x
* @example
* ```ts
* xnumber.constrain(20, 0, 50);
* // → 20
*
* xnumber.constrain(-10, 0, 100);
* // → 0
*
* xnumber.constrain(120, 0, 100);
* // → 100
* ```
*/ export declare function constrain(x: number, min: number, max: number): number;
export { constrain as clamp };
/**
* Normalize a number from its current range into a value between 0 and 1.
* @param x a number
* @param r lower bound of current range
* @param R upper bound of current range
* @returns ∈ [0, 1]
* @example
* ```ts
* xnumber.normalize(20, 0, 50);
* // → 0.4
*
* xnumber.normalize(-10, 0, 100);
* // → -0.1
* ```
*/ export declare function normalize(x: number, r: number, R: number): number;
export { normalize as norm };
/**
* Re-map a number from one range to another.
* @param x a number
* @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]
* @example
* ```ts
* xnumber.remap(25, 0, 100, 0, 1366);
* // → 341.5
*
* xnumber.remap(110, 0, 100, -20, -10);
* // → -9
* ```
*/ export declare function remap(x: number, r: number, R: number, t: number, T: number): number;
export { remap as map };
/**
* Linearly interpolate a number between two numbers.
* @param x start number
* @param y stop number
* @param t interpolant ∈ [0, 1]
* @returns ∈ [x, y]
* @example
* ```ts
* xnumber.lerp(80, 320, 0.8);
* // → 272
*
* xnumber.lerp(80, 320, 0.20);
* // → 128
*
* xnumber.lerp(80, 320, 0.32);
* // → 156.8
* ```
*/ export declare function lerp(x: number, y: number, t: number): number;
/**
* Make a number purely fractional, by shifting the decimal point.
* @param x a number
* @param n maximum number of digits to shift (-1: all) [20]
* @returns fractional number
* @example
* ```ts
* xnumber.fractionize(123);
* // → 0.123
*
* xnumber.fractionize(-9876, 3);
* // → -0.988
*
* xnumber.fractionize(0.001234, 3);
* // → 0.001
* ```
*/ export declare function fractionize(x: number, n?: number): number;
/**
* Make a number purely integer, by shifting the decimal point.
* @param x a number
* @param n maximum number of digits to shift (-1: all) [20]
* @returns integer number
* @example
* ```ts
* xnumber.defractionize(0.123);
* // → 123
*
* xnumber.defractionize(-0.988, 2);
* // → -99
*
* xnumber.defractionize(12.345, 2);
* // → 1235
* ```
*/ export declare function defractionize(x: number, n?: number): number;
/**
* Check if a number is a power-of-n.
* @param x a number
* @param n base
* @returns nⁱ = x? | i = +ve integer
* @example
* ```ts
* xnumber.isPow(32, 2);
* // → true
*
* xnumber.isPow(32, 4);
* // → false
*
* xnumber.isPow(64, 4);
* // → true
* ```
*/ export declare function isPow(x: number, n: number): boolean;
/**
* Find largest power-of-n less than or equal to given number.
* @param x a number
* @param n base
* @returns nⁱ | nⁱ ≤ x and nⁱ > x/n
* @example
* ```ts
* xnumber.prevPow(32, 2);
* // → 32
*
* xnumber.prevPow(35, 2);
* // → 32
*
* xnumber.prevPow(35, 3);
* // → 27
* ```
*/ export declare function prevPow(x: number, n: number): number;
/**
* Find smallest power-of-n greater than or equal to given number.
* @param x a number
* @param n base
* @returns nⁱ | nⁱ ≥ x and nⁱ < n*x
* @example
* ```ts
* xnumber.nextPow(32, 2);
* // → 32
*
* xnumber.nextPow(29, 2);
* // → 32
*
* xnumber.nextPow(29, 3);
* // → 81
* ```
*/ export declare function nextPow(x: number, n: number): number;
/**
* Find the nth root of a number (ⁿ√).
* @param x a number
* @param n root
* @returns ⁿ√x
* @example
* ```ts
* xnumber.root(25, 2);
* // → 5
*
* xnumber.root(-8, 3);
* // → -2
* ```
*/ export declare function root(x: number, n: number): number;
/**
* Find the logarithm of a number with a given base.
* @param x a number
* @param b logarithm base [e]
* @returns log_b (x)
* @example
* ```ts
* xnumber.log(Math.E);
* // → 1
*
* xnumber.log(10);
* // → 2.302585092994046
*
* xnumber.log(243, 3);
* // → 5
*
* xnumber.log(64, 2);
* // → 6
* ```
*/ export declare function log(x: number, b?: number): number;
/**
* List all divisors of a number, except itself.
* @param x a number
* @returns proper divisors (factors)
* @example
* ```ts
* xnumber.properDivisors(6);
* // → [1, 2, 3]
*
* xnumber.properDivisors(1);
* // → []
*
* xnumber.properDivisors(0);
* // → []
*
* xnumber.properDivisors(-24);
* // → [1, 2, 3, 4, 6, 8, 12]
* ```
*/ export declare function properDivisors(x: number): number[];
export { properDivisors as aliquotParts };
/**
* Sum all proper divisors of a number.
* @param x a number
* @returns Σdᵢ | dᵢ is a divisor of x and ≠x
* @example
* ```ts
* xnumber.aliquotSum(6);
* // → 6 (1+2+3)
*
* xnumber.aliquotSum(1);
* // → 0
*
* xnumber.aliquotSum(0);
* // → 0
*
* xnumber.aliquotSum(-24);
* // → 36 (1+2+3+4+6+8+12)
* ```
*/ export declare function aliquotSum(x: number): number;
/**
* Find the least prime number which divides a number.
* @param x a number
* @returns least prime factor
* @example
* ```ts
* xnumber.minPrimeFactor(1);
* // → 0
*
* xnumber.minPrimeFactor(3);
* // → 3
*
* xnumber.minPrimeFactor(21);
* // → 3
*
* xnumber.minPrimeFactor(55);
* // → 5
*
* xnumber.minPrimeFactor(53);
* // → 53
* ```
*/ export declare function minPrimeFactor(x: number): number;
export { minPrimeFactor as leastPrimeFactor };
/**
* Find the greatest prime number which divides a number.
* @param x a number
* @returns greatest prime factor
* @example
* ```ts
* xnumber.maxPrimeFactor(1);
* // → 0
*
* xnumber.maxPrimeFactor(3);
* // → 3
*
* xnumber.maxPrimeFactor(21);
* // → 7
*
* xnumber.maxPrimeFactor(55);
* // → 11
*
* xnumber.maxPrimeFactor(53);
* // → 53
* ```
*/ export declare function maxPrimeFactor(x: number): number;
export { maxPrimeFactor as greatestPrimeFactor };
/**
* Find the prime factors of a number.
* @param x a number
* @returns [f₀, f₁, ...] | fᵢ divides x and is prime
* @example
* ```ts
* xnumber.primeFactors(1);
* // → []
*
* xnumber.primeFactors(3);
* // → [3]
*
* xnumber.primeFactors(21);
* // → [3, 7]
*
* xnumber.primeFactors(55);
* // → [5, 11]
*
* xnumber.primeFactors(53);
* // → [53]
* ```
*/ export declare function primeFactors(x: number): number[];
/**
* Find the prime factors and respective exponents of a number.
* @param x a number
* @returns [[f₀, e₀], [f₁, e₁], ...] | fᵢ is a prime factor of x and eᵢ is its exponent
* @example
* ```ts
* xnumber.primeExponentials(1);
* // → []
*
* xnumber.primeExponentials(9);
* // → [[3, 2]]
*
* xnumber.primeExponentials(63);
* // → [[3, 2], [7, 1]]
*
* xnumber.primeExponentials(605);
* // → [[5, 1], [11, 2]]
*
* xnumber.primeExponentials(53);
* // → [[53, 1]]
* ```
*/ export declare function primeExponentials(x: number): [number, number][];
/**
* Examine if number is prime.
* @param x a number
* @returns is divisible by 1 and itself only?
* @example
* ```ts
* xnumber.isPrime(7);
* // → true
*
* xnumber.isPrime(53);
* // → true
*
* xnumber.isPrime(4);
* // → false
*
* xnumber.isPrime(1);
* // → false
*
* xnumber.isPrime(0);
* // → false
* ```
*/ export declare function isPrime(x: number): boolean;
/**
* Find the greatest common divisor of numbers.
* @param xs a list of numbers
* @returns gcd(x₁, x₂, ...)
* @example
* ```ts
* xnumber.gcd(6, 15);
* // → 3
*
* xnumber.gcd(6, 15, 21);
* // → 3
*
* xnumber.gcd(6, 15, 20);
* // → 1
* ```
*/ export declare function gcd(...xs: number[]): number;
export { gcd as hcf };
/**
* Find the least common multiple of numbers.
* @param xs a list of numbers
* @returns lcm(x₁, x₂, ...)
* @example
* ```ts
* xnumber.lcm(2, 3);
* // → 6
*
* xnumber.lcm(2, 3, 4);
* // → 12
*
* xnumber.lcm(2, 3, 4, 5);
* // → 60
* ```
*/ export declare function lcm(...xs: number[]): number;
/**
* Find the factorial of a number.
* @param n a number
* @param k denominator factorial [0]
* @returns P(n, k); k=0: n!, k>0: n!/k!
* @example
* ```ts
* xnumber.factorial(5);
* // → 120
*
* xnumber.factorial(6);
* // → 720
*
* xnumber.factorial(7);
* // → 5040
* ```
*/ export declare function factorial(n: number, k?: number): number;
/**
* Find the number of ways to choose k elements from a set of n elements.
* @param n elements in source set
* @param k elements in choose set
* @returns C(n, k)
* @example
* ```ts
* xnumber.binomial(4, 1);
* // → 4
*
* xnumber.binomial(4, 2);
* // → 6
*
* xnumber.binomial(4, 3);
* // → 4
* ```
*/ export declare function binomial(n: number, k: number): number;
/**
* Find the number of ways to put n objects in m bins (n=sum(kᵢ)).
* @param ks objects per bin (kᵢ)
* @returns n!/(k₁!k₂!...) | n=sum(kᵢ)
* @example
* ```ts
* xnumber.multinomial(1, 2);
* // → 3
*
* xnumber.multinomial(1, 2, 3);
* // → 60
*
* xnumber.multinomial(1, 2, 3, 4);
* // → 12600
* ```
*/ export declare function multinomial(...ks: number[]): number;
/**
* Convert radians to degrees.
* @param x radians
* @returns 2π → 360
* @example
* ```ts
* xnumber.degrees(3);
* // → 171.88733853924697
*
* xnumber.degrees(1);
* // → 57.29577951308232
* ```
*/ export declare function degrees(x: number): number;
/**
* Convert degrees to radians.
* @param x degrees
* @returns 360 → 2π
* @example
* ```ts
* xnumber.radians(180);
* // → 3.141592653589793
*
* xnumber.radians(60);
* // → 1.0471975511965976
* ```
*/ export declare function radians(x: number): number;
/**
* Find the sum of numbers (Σ).
* @param xs a list of numbers
* @returns Σxᵢ
* @example
* ```ts
* xnumber.sum(1, 2);
* // → 3
*
* xnumber.sum(1, 2, 3);
* // → 6
*
* xnumber.sum(1, 2, 3, 4);
* // → 10
* ```
*/ export declare function sum(...xs: number[]): number;
/**
* Find the product of numbers (∏).
* @param xs a list of numbers
* @returns ∏xᵢ
* @example
* ```ts
* xnumber.product(1, 2);
* // → 2
*
* xnumber.product(1, 2, 3);
* // → 6
*
* xnumber.product(1, 2, 3, 4);
* // → 24
* ```
*/ export declare function product(...xs: number[]): number;
/**
* Find the value separating the higher and lower halves of numbers.
* @param xs a list of numbers
* @returns xₘ | sort(xs) = [..., xₘ, ...]
* @example
* ```ts
* xnumber.median(1, 7);
* // → 4
*
* xnumber.median(1, 7, 8);
* // → 7
*
* xnumber.median(1, 7, 8, 10);
* // → 7.5
* ```
*/ export declare function median(...xs: number[]): number;
/**
* Find the values that appear most often.
* @param xs a list of numbers
* @returns [xₘ₁, xₘ₂, ...] | count(xₘᵢ) ≥ count(xᵢ) ∀ xᵢ ∈ xs
* @example
* ```ts
* xnumber.modes(1, 2);
* // → [1, 2]
*
* xnumber.modes(1, 2, 2);
* // → [2]
*
* xnumber.modes(1, 2, 2, 3, 3);
* // → [2, 3]
* ```
*/ export declare function modes(...xs: number[]): number[];
/**
* Find the smallest and largest values.
* @param xs a list of numbers
* @returns [min(xs), max(xs)]
* @example
* ```ts
* xnumber.range(1, 7);
* // → 6
*
* xnumber.range(1, 7, 6);
* // → 6
*
* xnumber.range(1, 7, 8, 6);
* // → 7
* ```
*/ export declare function range(...xs: number[]): [number, number];
/**
* Find the mean of squared deviation of numbers from its mean.
* @param xs a list of numbers
* @returns σ² = E[(xs - µ)²] | µ = mean(xs)
* @example
* ```ts
* xnumber.variance(1, 2);
* // → 0.25
*
* xnumber.variance(1, 2, 3);
* // → 0.6666666666666666
*
* xnumber.variance(1, 2, 3, 4);
* // → 1.25
* ```
*/ export declare function variance(...xs: number[]): number;
/**
* Find the average of numbers.
* @param xs a list of numbers
* @returns Σxᵢ/n | n = size(xs)
* @example
* ```ts
* xnumber.arithmethicMean(1, 2);
* // → 1.5
*
* xnumber.arithmethicMean(1, 2, 3);
* // → 2
*
* xnumber.arithmethicMean(1, 2, 3, 4);
* // → 2.5
* ```
*/ export declare function arithmeticMean(...xs: number[]): number;
export { arithmeticMean as mean };
/**
* Find the geometric mean of numbers.
* @param xs a list of numbers
* @returns ⁿ√(∏xᵢ) | n = size(xs)
* @example
* ```ts
* xnumber.geometricMean(1, 2);
* // → 1.4142135623730951 (Math.sqrt(2))
*
* xnumber.geometricMean(1, 2, 3);
* // → 1.8171205928321397 (Math.cbrt(6))
*
* xnumber.geometricMean(1, 2, 3, 4);
* // → 2.2133638394006434 (Math.pow(24, 1/4))
* ```
*/ export declare function geometricMean(...xs: number[]): number;
/**
* Find the harmonic mean of numbers.
* @param xs a list of numbers
* @returns n/Σ(1/xᵢ) | n = size(xs)
* @example
* ```ts
* xnumber.harmonicMean(1, 2);
* // → 1.3333333333333333 (4/3)
*
* xnumber.harmonicMean(1, 2, 3);
* // → 1.6363636363636365 (18/11)
*
* xnumber.harmonicMean(1, 2, 3, 4);
* // → 1.92 (48/25)
* ```
*/ export declare function harmonicMean(...xs: number[]): number;
/**
* Find the quadriatic mean of numbers.
* @param xs a list of numbers
* @returns √(Σxᵢ²)/n | n = size(xs)
* @example
* ```ts
* xnumber.quadriaticMean(1, 2);
* // → 1.5811388300841898 (Math.sqrt(5/2))
*
* xnumber.quadriaticMean(1, 2, 3);
* // → 2.160246899469287 (Math.sqrt(14/3))
*
* xnumber.quadriaticMean(1, 2, 3, 4);
* // → 2.7386127875258306 (Math.sqrt(30/4))
* ```
*/ export declare function quadriaticMean(...xs: number[]): number;
export { quadriaticMean as rootMeanSquare };
/**
* Find the cubic mean of numbers.
* @param xs a list of numbers
* @returns ³√(Σxᵢ³)/n | n = size(xs)
* @example
* ```ts
* xnumber.cubicMean(1, 2);
* // → 1.6509636244473134 (Math.cbrt(9/2))
*
* xnumber.cubicMean(1, 2, 3);
* // → 2.2894284851066637 (Math.cbrt(36/3))
*
* xnumber.cubicMean(1, 2, 3, 4);
* // → 2.924017738212866 (Math.cbrt(100/4))
* ```
*/ export declare function cubicMean(...xs: number[]): number;
/**
* Convert roman numerals to number.
* @param txt roman numerals
* @returns eg. XCV -> 95, IV.V -> 4.5, IXe+II -> 900
* @example
* ```ts
* xnumber.fromRomanNumerals('XCV');
* // → 95
*
* xnumber.fromRomanNumerals('IV.V');
* // → 4.5
*
* xnumber.fromRomanNumerals('IXe+II');
* // → 900
* ```
*/ export declare function fromRomanNumerals(txt: string): number;
export { fromRomanNumerals as fromRoman };
/**
* Convert number to roman numerals.
* @param x a number
* @param exp use exponential/scientific notation [false]
* @returns eg. 95 -> XCV, 4.5 -> IV.V, 900 -> IXe+II (scientific = true)
* @example
* ```ts
* xnumber.toRomanNumerals(95);
* // → 'XCV'
*
* xnumber.toRomanNumerals(4.5);
* // → 'IV.V'
*
* xnumber.toRomanNumerals(900, true);
* // → 'IXe+II'
* ```
*/ export declare function toRomanNumerals(x: number, exp?: boolean): string;
export { toRomanNumerals as toRoman };
export declare function toRomanInteger(x: number): string;