{"version":3,"file":"index.modern.mjs","sources":["../src/core/array/_copy.js","../src/core/arithmetic/add/_add.js","../src/api/arithmetic/add/add.js","../src/core/arithmetic/add/_iadd.js","../src/api/arithmetic/add/iadd.js","../src/api/arithmetic/add/increment.js","../src/core/arithmetic/div/_idivmod_limb_with_prefix.js","../src/core/arithmetic/div/_idivmod_limb.js","../src/core/array/_alloc.js","../src/core/array/_fill.js","../src/core/array/_reset.js","../src/core/array/_zeros.js","../src/core/arithmetic/mul/_mul_limb.js","../src/api/compare/jz.js","../src/core/convert/_trim_positive.js","../src/core/compare/_cmp_n.js","../src/core/compare/_cmp.js","../src/api/compare/cmp.js","../src/api/compare/lt.js","../src/core/array/_validate.js","../src/core/arithmetic/sub/_isub.js","../src/core/compare/_cmp_half_even_radix.js","../src/core/compare/_cmp_half_odd_radix.js","../src/core/compare/_cmp_half.js","../src/api/compare/gt.js","../src/core/arithmetic/div/_idivmod_schoolbook_subroutine_do.js","../src/core/arithmetic/div/_idivmod_schoolbook_subroutine.js","../src/core/arithmetic/div/_idivmod_schoolbook_large_divisor.js","../src/core/arithmetic/div/_div_limb_with_prefix.js","../src/core/arithmetic/div/_idivmod_schoolbook.js","../src/core/arithmetic/mul/_imul_limb.js","../src/core/thresholds/THRESHOLD_MUL_TOOM22.js","../src/core/thresholds/THRESHOLD_DIV_DC.js","../src/core/arithmetic/mul/_schoolbook_mul.js","../src/core/arithmetic/mul/_karatsuba_right_op_is_small.js","../src/core/arithmetic/mul/_karatsuba.js","../src/core/arithmetic/mul/_mul.js","../src/api/arithmetic/sub/decrement.js","../src/core/arithmetic/div/_idivmod_dc_32.js","../src/core/arithmetic/div/_idivmod_dc_21.js","../src/core/arithmetic/div/_mod_limb.js","../src/core/arithmetic/div/_idivmod_dc.js","../src/api/arithmetic/div/_idivmod.js","../src/api/arithmetic/div/_divmod.js","../src/core/arithmetic/div/_imod_limb.js","../src/core/arithmetic/div/_imod_schoolbook_subroutine_do.js","../src/core/arithmetic/div/_imod_schoolbook_subroutine.js","../src/core/arithmetic/div/_imod_schoolbook_large_divisor.js","../src/core/arithmetic/div/_imod_schoolbook.js","../src/api/arithmetic/div/_imod.js","../src/api/compare/ge.js","../src/core/arithmetic/gcd/_euclidean_algorithm_loop.js","../src/api/arithmetic/gcd/euclidean_algorithm.js","../src/core/arithmetic/gcd/_extended_euclidean_algorithm_allocate.js","../src/api/arithmetic/mul/mul.js","../src/core/arithmetic/gcd/_extended_euclidean_algorithm_loop.js","../src/core/arithmetic/gcd/_extended_euclidean_algorithm.js","../src/api/arithmetic/gcd/extended_euclidean_algorithm.js","../src/api/compare/eq.js","../src/api/compare/le.js","../src/api/compare/ne.js","../src/core/thresholds/THRESHOLD_CONVERT_DC.js","../src/core/convert/_log.js","../src/core/convert/_convert_to_smaller_fast.js","../src/core/convert/_convert_to_smaller_slow.js","../src/core/array/_build.js","../src/core/arithmetic/pow/_pow_double.js","../src/core/arithmetic/add/_iadd_limb.js","../src/core/convert/_convert_to_larger_slow.js","../src/core/convert/_convert_slow.js","../src/core/convert/_convert_dc.js","../src/core/convert/_convert_to_smaller.js","../src/core/convert/_convert_to_larger_fast.js","../src/core/convert/_convert_to_larger.js","../src/core/convert/_convert.js","../src/core/convert/convert_keep_zeros.js","../src/core/convert/trim_natural.js","../src/api/convert/convert.js","../src/core/convert/_int.js","../src/core/convert/_from_string.js","../src/core/convert/parse_keep_zeros.js","../src/api/convert/parse.js","../src/core/convert/_chr.js","../src/core/convert/_to_string.js","../src/api/convert/stringify.js","../src/api/convert/translate.js","../src/core/arithmetic/sub/_sub.js","../src/core/arithmetic/div/_idivmod_slow.js","../src/core/arithmetic/mul/_toom22.js","../src/core/arithmetic/pow/_pow_double_recursive.js"],"sourcesContent":["import assert from 'assert';\n\n/**\n * Copy a limb array into another limb array.\n *\n * @param {number[]} a The copied limb array.\n * @param {number} ai\n * @param {number} aj\n * @param {number[]} b The destination limb array.\n * @param {number} bi\n */\nexport default function _copy(a, ai, aj, b, bi) {\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0);\n\tassert(b.length - bi >= aj - ai);\n\n\tfor (; ai < aj; ++ai, ++bi) b[bi] = a[ai];\n\t// While ( ai < aj ) b[++bi] = a[++ai] ;\n}\n","import assert from 'assert';\nimport _copy from '../../array/_copy.js';\n\n/**\n * Adds two big endian arrays and puts result in a destination array.\n * Wraps on overflow. |C| >= |A| >= |B|.\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {Array} c result, must be 0 initialized\n * @param {Number} ci c left\n * @param {Number} cj c right\n */\n\nexport default function _add(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(cj - ci >= aj - ai);\n\tassert(aj - ai >= bj - bi);\n\n\tlet C = 0;\n\n\twhile (--bj >= bi) {\n\t\tconst t = a[--aj] + b[bj] + C;\n\t\tc[--cj] = t % r;\n\t\tC = (t >= r) | 0;\n\t}\n\n\tif (C !== 0) {\n\t\twhile (--aj >= ai && a[aj] === r - 1) c[--cj] = 0;\n\t\tif (--cj >= ci) {\n\t\t\tif (aj >= ai) {\n\t\t\t\tc[cj] = a[aj] + 1;\n\t\t\t} else c[cj] = 1;\n\t\t}\n\t}\n\n\t_copy(a, ai, aj, c, cj - aj + ai);\n}\n","import _add from '../../../core/arithmetic/add/_add.js';\n\n/**\n * Adds two big endian arrays and puts result in a destination array.\n * Wraps on overflow. Works with any combination of array sizes.\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {Array} c result, must be 0 initialized\n * @param {Number} ci c left\n * @param {Number} cj c right\n *\n */\nexport default function add(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tci = Math.max(0, ci);\n\tconst k = cj - ci;\n\n\tai = Math.max(0, ai, aj - k);\n\tbi = Math.max(0, bi, bj - k);\n\tconst m = aj - ai;\n\tconst n = bj - bi;\n\n\treturn m < n\n\t\t? _add(r, b, bi, bj, a, ai, aj, c, ci, cj)\n\t\t: _add(r, a, ai, aj, b, bi, bj, c, ci, cj);\n}\n","import assert from 'assert';\n\n/**\n * Adds a big endian array to another.\n * Wraps on overflow. |A| >= |B|.\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n */\n\nexport default function _iadd(r, a, ai, aj, b, bi, bj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= bj - bi);\n\n\tlet C = 0;\n\n\twhile (--bj >= bi) {\n\t\tconst T = a[--aj] + b[bj] + C;\n\t\ta[aj] = T % r;\n\t\tC = (T >= r) | 0;\n\t}\n\n\tif (C !== 0) {\n\t\twhile (--aj >= ai && a[aj] === r - 1) a[aj] = 0;\n\t\tif (aj >= ai) ++a[aj];\n\t}\n}\n","import _iadd from '../../../core/arithmetic/add/_iadd.js';\n\n/**\n * Adds a big endian array to another ___in-place___.\n * Wraps on overflow. Works with any combination of array sizes.\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand (modified in-place)\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n */\nexport default function iadd(r, a, ai, aj, b, bi, bj) {\n\tconst m = aj - ai;\n\n\treturn _iadd(r, a, ai, aj, b, Math.max(bi, bj - m), bj);\n}\n","import assert from 'assert';\n\n/**\n * Adds 1 to a big endian array.\n *\n * Wraps on overflow. Hence, does nothing if aj <= ai.\n *\n * O(|A|) time in the worst case.\n * O(1) amortized time over any number of successive operations starting with A = O(1).\n * O(1) amortized time over O(|A|) successive operations starting with any A.\n *\n * @param {Number} r radix\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n */\nexport default function increment(r, a, ai, aj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\n\tconst _r = r - 1;\n\n\twhile (--aj >= ai) {\n\t\tif (a[aj] < _r) {\n\t\t\t++a[aj];\n\t\t\treturn;\n\t\t}\n\n\t\ta[aj] = 0;\n\t}\n}\n","import assert from 'assert';\n\n/**\n * Divides a big endian number by a single limb number.\n * Can only work with limbs of size at most sqrt( 2^53 ).\n * Allows to prefix the dividend with an intermediate remainder.\n *\n * Input\n * -----\n *  - |Q| = |D| >= 1.\n *  - NO NEED to reset Q. The loop will set every member of Q.\n *\n * @param {Number} r The radix.\n * @param {Number} tmp Intermediate remainder (MUST be <code>< d</code>).\n * @param {Number} d The divisor >= 1.\n * @param {Array} D The dividend.\n * @param {Number} Di Left of dividend.\n * @param {Number} Dj Right of dividend.\n * @param {Array} Q The quotient.\n * @param {Number} Qi Left of quotient.\n */\nexport default function _idivmod_limb_with_prefix(r, tmp, d, D, Di, Dj, Q, Qi) {\n\tassert(r >= 2);\n\n\tassert(d >= 1 && d <= r - 1);\n\tassert(tmp >= 0 && tmp <= d - 1);\n\n\tassert(Di >= 0 && Dj <= D.length);\n\tassert(Qi >= 0);\n\n\tassert(Dj - Di <= Q.length - Qi);\n\tassert(Dj - Di >= 1);\n\n\twhile (Di < Dj) {\n\t\ttmp *= r;\n\t\ttmp += D[Di];\n\n\t\tQ[Qi] = (tmp / d) | 0;\n\t\ttmp %= d;\n\t\tD[Di] = 0;\n\n\t\t++Qi;\n\t\t++Di;\n\t}\n\n\tD[Dj - 1] = tmp;\n}\n","import _idivmod_limb_with_prefix from './_idivmod_limb_with_prefix.js';\n\n/**\n * Divides a big endian number by a single limb number.\n * Can only work with limbs of size at most sqrt( 2^53 ).\n *\n * @param {Number} r The radix.\n * @param {Number} d The divisor.\n * @param {Array} D The dividend.\n * @param {Number} Di Left of dividend.\n * @param {Number} Dj Right of dividend.\n * @param {Array} Q The quotient.\n * @param {Number} Qi Left of quotient.\n */\nexport default function _idivmod_limb(r, d, D, Di, Dj, Q, Qi) {\n\t// Simply prefix the dividend with 0\n\treturn _idivmod_limb_with_prefix(r, 0, d, D, Di, Dj, Q, Qi);\n}\n","import assert from 'assert';\n\n/**\n * Allocate a new limb array.\n *\n * @param {number} n The size of the array to allocate.\n *\n * @return {number[]} The new limb array.\n */\nexport default function _alloc(n) {\n\tassert(n >= 0);\n\n\treturn new Array(n);\n}\n","import assert from 'assert';\n\n/**\n * Fill the input limb array with a fixed value.\n *\n * @param {number[]} a input limb array\n * @param {number} ai\n * @param {number} aj\n * @param {number} v the value used to fill the input array\n */\nexport default function _fill(a, ai, aj, v) {\n\tassert(ai >= 0);\n\tassert(aj <= a.length);\n\tassert(aj - ai >= 0);\n\tassert(typeof v === 'number');\n\n\tfor (let i = ai; i < aj; ++i) a[i] = v;\n}\n","import assert from 'assert';\nimport _fill from './_fill.js';\n\n/**\n * Fill the input limb array with zeros.\n *\n * @param {number[]} a input limb array\n * @param {number} ai\n * @param {number} aj\n */\nexport default function _reset(a, ai, aj) {\n\tassert(ai >= 0);\n\tassert(aj <= a.length);\n\tassert(aj - ai >= 0);\n\n\t_fill(a, ai, aj, 0);\n}\n","import assert from 'assert';\nimport _alloc from './_alloc.js';\nimport _reset from './_reset.js';\n\n/**\n * Allocate a new limb array filled with zeros.\n *\n * @param {number} n The size of the allocated array.\n *\n * @return {number[]} The newly allocated array.\n */\nexport default function _zeros(n) {\n\tassert(n >= 0);\n\n\tconst a = _alloc(n);\n\n\t_reset(a, 0, n);\n\n\treturn a;\n}\n","import assert from 'assert';\n\n/**\n * Compute x * b where x is a single limb.\n * 0 <= x <= r-1\n * No restriction on operand sizes.\n */\n\nexport default function _mul_limb(r, x, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(x >= 0 && x <= r - 1);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\n\tlet C = 0;\n\n\twhile (true) {\n\t\t--bj;\n\t\t--cj;\n\n\t\tif (bj < bi) {\n\t\t\tif (cj >= ci) c[cj] = C;\n\t\t\treturn;\n\t\t}\n\n\t\tif (cj < ci) return;\n\n\t\tconst t = b[bj] * x + C;\n\n\t\tc[cj] = t % r;\n\n\t\tC = (t / r) | 0;\n\t}\n}\n","import assert from 'assert';\n\n/**\n * Returns true if and only if input number A is 0.\n *\n * Returns true if aj <= ai.\n * O(|A|) time in the worst case.\n * O(1) time if A has no leading zero.\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @return {boolean} true if and only if input number is 0.\n */\n\nexport default function jz(a, ai, aj) {\n\tassert(ai >= 0 && aj <= a.length);\n\n\tfor (; ai < aj; ++ai) if (a[ai] !== 0) return false;\n\n\treturn true;\n}\n","import assert from 'assert';\n\n/**\n * Compute the new inclusive left bound of a limb array by skipping all\n * leading zeros.\n *\n * @param {number[]} a The input limb array.\n * @param {number} ai\n * @param {number} aj\n *\n * @return {number} The new inclusive left bound of the input.\n */\nexport default function _trim_positive(a, ai, aj) {\n\tassert(ai >= 0 && aj <= a.length);\n\n\twhile (ai < aj && a[ai] === 0) ++ai;\n\n\treturn ai;\n}\n","import assert from 'assert';\n\n/**\n * Compares two big endian arrays.\n *\n * Input:\n *   - |A| = |B|\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n *\n * @return {number} 1 if a > b; 0 if a = b; -1 otherwise.\n */\n\nexport default function _cmp_n(a, ai, aj, b, bi) {\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0);\n\tassert(b.length - bi >= aj - ai);\n\n\tfor (; ai < aj; ++ai, ++bi) {\n\t\tif (a[ai] > b[bi]) return 1;\n\t\tif (a[ai] < b[bi]) return -1;\n\t}\n\n\treturn 0;\n}\n","import assert from 'assert';\n\nimport _cmp_n from './_cmp_n.js';\n\n/**\n * Compares two big endian arrays. The second operand cannot have more limbs\n * than the first.\n *\n * Input:\n *   - |A| >= |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {number} result 1 if a > b; 0 if a = b; -1 otherwise.\n */\n\nexport default function _cmp(a, ai, aj, b, bi, bj) {\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= bj - bi);\n\tassert(bj - bi >= 0);\n\n\tconst tmp = aj - bj + bi;\n\n\tfor (; ai < tmp; ++ai) if (a[ai] > 0) return 1;\n\n\tassert(aj - ai === bj - bi);\n\treturn _cmp_n(a, ai, aj, b, bi);\n}\n","import _cmp from '../../core/compare/_cmp.js';\n\n/**\n * Compares two big endian arrays with little constraints on the operands.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {number} result 1 if a > b; 0 if a = b; -1 otherwise.\n */\n\nexport default function cmp(a, ai, aj, b, bi, bj) {\n\tif (aj - ai < bj - bi) return -_cmp(b, bi, bj, a, ai, aj);\n\treturn _cmp(a, ai, aj, b, bi, bj);\n}\n","import cmp from './cmp.js';\n\n/**\n * Compares two big endian arrays: returns true if the first is less than\n * the second.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {boolean} true iff A < B.\n */\nconst lt = (a, ai, aj, b, bi, bj) => cmp(a, ai, aj, b, bi, bj) < 0;\nexport default lt;\n","import assert from 'assert';\n\nexport default function _validate(base, a, ai, aj) {\n\tassert(Number.isInteger(base));\n\tassert(base >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\n\tfor (; ai < aj; ++ai) {\n\t\tconst x = a[ai];\n\t\tassert(Number.isInteger(x));\n\t\tassert(x >= 0 && x <= base - 1);\n\t}\n\n\treturn true;\n}\n","import assert from 'assert';\n\n/**\n * Subtracts B from A, |A| >= |B|.\n * Wraps.\n *\n * @param {Number} r base (radix)\n * @param {array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n */\n\nexport default function _isub(r, a, ai, aj, b, bi, bj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= bj - bi);\n\n\tlet C = 0;\n\n\twhile (--bj >= bi) {\n\t\t--aj;\n\t\tconst T = C;\n\t\tC = (a[aj] < b[bj] + T) | 0;\n\t\ta[aj] = a[aj] - b[bj] + (C * r - T);\n\t}\n\n\tif (C !== 0) {\n\t\twhile (--aj >= ai && a[aj] === 0) a[aj] = r - 1;\n\t\tif (aj >= ai) --a[aj];\n\t}\n}\n","import assert from 'assert';\n\nimport jz from '../../api/compare/jz.js';\n\nexport default function _cmp_half_even_radix(_r, a, ai, aj) {\n\tassert(_r >= 1);\n\tassert(ai >= 0 && aj <= a.length);\n\n\tif (ai >= aj || a[ai] < _r) return -1;\n\tif (a[ai] > _r) return 1;\n\treturn jz(a, ai + 1, aj) ? 0 : 1;\n}\n","import assert from 'assert';\n\nexport default function _cmp_half_odd_radix(_r, a, ai, aj) {\n\tassert(_r >= 1);\n\tassert(ai >= 0 && aj <= a.length);\n\n\tfor (; ai < aj; ++ai) {\n\t\tif (a[ai] > _r) return 1;\n\t\tif (a[ai] < _r) return -1;\n\t}\n\n\treturn -1;\n}\n","import assert from 'assert';\n\nimport _cmp_half_even_radix from './_cmp_half_even_radix.js';\nimport _cmp_half_odd_radix from './_cmp_half_odd_radix.js';\n\n/**\n * Compares a number A with size n = |A| to R = (r^n)/2.\n * When n=0, R=1/2, hence result is -1.\n *\n * @param {Number} r the base\n * @param {array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n *\n * @return {Number} result 1 if A > R; 0 if a = R; -1 otherwise.\n */\n\nexport default function _cmp_half(r, a, ai, aj) {\n\tassert(r >= 2);\n\n\tconst _r = Math.floor(r / 2) | 0;\n\n\tif (r % 2 === 0) return _cmp_half_even_radix(_r, a, ai, aj);\n\treturn _cmp_half_odd_radix(_r, a, ai, aj);\n}\n","import cmp from './cmp.js';\n\n/**\n * Compares two big endian arrays: returns true if the first is greater than\n * the second.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {boolean} true iff A > B.\n */\nconst gt = (a, ai, aj, b, bi, bj) => cmp(a, ai, aj, b, bi, bj) > 0;\nexport default gt;\n","import assert from 'assert';\n\nimport _zeros from '../../array/_zeros.js';\nimport _validate from '../../array/_validate.js';\nimport gt from '../../../api/compare/gt.js';\nimport _isub from '../sub/_isub.js';\nimport _mul_limb from '../mul/_mul_limb.js';\n\nimport _cmp_half from '../../compare/_cmp_half.js';\n\n/**\n * Input\n * -----\n *  - Two integers A and B such that 0 <= A < B * β and (β^n)/2 <= B < β^n.\n *    (Hence B >= 1).\n *  - |A| = |B| + 1\n *  - |Q| = |A|\n *\n * Output\n * -----\n *  The quotient floor( A/B ) and the remainder A mod B.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend.\n * @param {Number} ai Left of dividend.\n * @param {Number} aj Right of dividend.\n * @param {Array} b Divisor.\n * @param {Number} bi Left of divisor.\n * @param {Number} bj Right of divisor.\n * @param {Array} q Quotient.\n * @param {Number} qi Left of quotient.\n */\nexport default function _idivmod_schoolbook_subroutine_do(\n\tr,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n\tq,\n\tqi,\n) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(qi >= 0);\n\tassert(aj - ai === bj - bi + 1); // |a| = |b| + 1\n\tassert(q.length - qi >= aj - ai); // |q| >= |a|\n\tassert(_cmp_half(r, b, bi, bj) >= 0); // (r^n)/2 <= B < r^n\n\tassert(gt(b, bi, bj, a, ai, aj - 1)); // A < B * β\n\tassert(_validate(r, q, qi, qi + aj - ai));\n\n\tconst m = aj - ai;\n\n\t// Since A < B*β, then A/B < β\n\t// q <- min [ ( β a_0 + a_1 ) / b_0 , β - 1 ]\n\tlet _q = Math.min(r - 1, Math.floor((a[ai] * r + a[ai + 1]) / b[bi]));\n\n\t// Fix _q\n\tconst T = _zeros(m);\n\t_mul_limb(r, _q, b, bi, bj, T, 0, m);\n\n\tif (gt(T, 0, m, a, ai, aj)) {\n\t\t--_q;\n\t\t_isub(r, T, 0, m, b, bi, bj);\n\n\t\tif (gt(T, 0, m, a, ai, aj)) {\n\t\t\t--_q;\n\t\t\t_isub(r, T, 0, m, b, bi, bj);\n\t\t}\n\t}\n\n\tq[qi + m - 1] += _q;\n\n\t_isub(r, a, ai, aj, T, 0, m);\n}\n","import assert from 'assert';\n\nimport _cmp_half from '../../compare/_cmp_half.js';\nimport _cmp_n from '../../compare/_cmp_n.js';\nimport increment from '../../../api/arithmetic/add/increment.js';\nimport _isub from '../sub/_isub.js';\nimport _idivmod_schoolbook_subroutine_do from './_idivmod_schoolbook_subroutine_do.js';\n\n/**\n * Input\n * -----\n *  - Two integers A and B such that 0 <= A < β^(n+1) and (β^n)/2 <= B < β^n.\n *  - |A| = |B| + 1\n *  - |Q| = |A|\n *\n * Output\n * -----\n *  The quotient floor( A/B ) and the remainder A mod B.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend.\n * @param {Number} ai Left of dividend.\n * @param {Number} aj Right of dividend.\n * @param {Array} b Divisor.\n * @param {Number} bi Left of divisor.\n * @param {Number} bj Right of divisor.\n * @param {Array} q Quotient.\n * @param {Number} qi Left of quotient.\n */\nexport default function _idivmod_schoolbook_subroutine(\n\tr,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n\tq,\n\tqi,\n) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(qi >= 0);\n\tassert(q.length - qi >= aj - ai);\n\tassert(aj - ai === bj - bi + 1); // |A| = |B| + 1\n\tassert(q.length - qi >= aj - ai); // |Q| >= |A|\n\tassert(_cmp_half(r, b, bi, bj) >= 0); // (β^n)/2 <= B < β^n\n\n\t// If A ≥ B*β, compute the quotient q and remainder r of ( A − B*β ) / B\n\t// and return β + q and r.\n\t// Note that then A − B*β < B*β since A < 2 B*β because of the\n\t// preconditions above. Hence the preconditions hold for\n\t// _idivmod_schoolbook_subroutine_do.\n\tif (_cmp_n(a, ai, aj - 1, b, bi) >= 0) {\n\t\t_isub(r, a, ai, aj - 1, b, bi, bj);\n\t\t_idivmod_schoolbook_subroutine_do(r, a, ai, aj, b, bi, bj, q, qi);\n\t\tincrement(r, q, qi, qi + aj - ai - 1);\n\t} else {\n\t\t_idivmod_schoolbook_subroutine_do(r, a, ai, aj, b, bi, bj, q, qi);\n\t}\n}\n","import assert from 'assert';\n\nimport _trim_positive from '../../convert/_trim_positive.js';\nimport lt from '../../../api/compare/lt.js';\nimport _validate from '../../array/_validate.js';\nimport _isub from '../sub/_isub.js';\nimport _cmp_half from '../../compare/_cmp_half.js';\nimport _idivmod_schoolbook_subroutine from './_idivmod_schoolbook_subroutine.js';\n\n/**\n * Input\n * -----\n *  - Two integers A and B such that r^(m-1) <= A < r^m and (r^n)/2 <= B < r^(n).\n *  - No leading zeros (ONLY IN B?)\n *  - Q is initialized with some limbs.\n *\n * Output\n * -----\n *  The quotient floor( A/B ) and the remainder A mod B.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend.\n * @param {Number} ai Left of dividend.\n * @param {Number} aj Right of dividend.\n * @param {Array} b Divisor.\n * @param {Number} bi Left of divisor.\n * @param {Number} bj Right of divisor.\n * @param {Array} q Quotient.\n * @param {Number} qi Left of quotient.\n */\nexport default function _idivmod_schoolbook_large_divisor(\n\tr,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n\tq,\n\tqi,\n) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(qi >= 0);\n\tassert(q.length - qi >= aj - ai);\n\t// Assert(aj - ai <= 0 || a[ai] !== 0); // no leading zero NOT TRUE ?\n\tassert(_cmp_half(r, b, bi, bj) >= 0); // (r^n)/2 <= B < r^n (+ no leading zero)\n\tassert(_validate(r, q, qi, qi + aj - ai));\n\n\twhile (true) {\n\t\t// Non-recursive\n\n\t\tconst m = aj - ai;\n\t\tconst n = bj - bi;\n\n\t\t// If m < n, return the quotient 0 and the remainder A.\n\t\tif (m < n) return;\n\n\t\tif (m === n) {\n\t\t\t// If m = n, then if A < B, return the quotient 0 and the remainder A;\n\t\t\tif (lt(a, ai, aj, b, bi, bj)) return;\n\n\t\t\t// If A ≥ B, return the quotient 1 and the remainder A - B.\n\t\t\t++q[qi + m - 1];\n\t\t\t_isub(r, a, ai, aj, b, bi, bj);\n\t\t\treturn;\n\t\t}\n\n\t\t// If m = n + 1, compute the quotient and remainder of A/B\n\t\t// using algorithm 3.1 and return them.\n\t\tif (m === n + 1)\n\t\t\treturn _idivmod_schoolbook_subroutine(r, a, ai, aj, b, bi, bj, q, qi);\n\n\t\t// 4. A' <- A/β^{m-n-1} and s <- A mod β^{m-n-1}\n\t\tconst _aj = ai + n + 1;\n\n\t\t// 5. Compute the quotient q' and the remainder r' of A'/B using algorithm 3.1.\n\t\t_idivmod_schoolbook_subroutine(r, a, ai, _aj, b, bi, bj, q, qi);\n\n\t\t// 6. Compute the quotient q and remainder r of( β^{m-n-1} r' + s ) / B recursively.\n\t\tconst ak = _trim_positive(a, ai, _aj);\n\t\t// _idivmod_schoolbook_large_divisor( r , a , ak , aj , b , bi , bj , q , qi + ak - ai ) ;\n\t\tqi += ak - ai; // Non recursive because some implementation\n\t\tai = ak; // Do not have tail-call optimization ?\n\n\t\t// 7. Return the quotient Q = β^{m-n-1} q' + q and remainder R = r\n\t}\n}\n","import assert from 'assert';\n\n/**\n * Divides a big endian number by a single limb number.\n * Can only work with limbs of size at most sqrt( 2^53 ).\n * Allows to prefix the dividend with an intermediate remainder.\n *\n * Does not update the remainder.\n *\n * Input\n * -----\n *  - 0 <= tmp <= d - 1\n *  - 1 <= d <= r - 1\n *  - |Q| = |D|\n *\n * @param {Number} r The radix.\n * @param {Number} tmp Intermediate remainder (MUST be <code>< d</code>).\n * @param {Number} d The divisor >= 1.\n * @param {Array} D The dividend (NOT modified).\n * @param {Number} Di Left of dividend.\n * @param {Number} Dj Right of dividend.\n * @param {Array} Q The quotient.\n * @param {Number} Qi Left of quotient.\n */\nexport default function _div_limb_with_prefix(r, tmp, d, D, Di, Dj, Q, Qi) {\n\tassert(r >= 2);\n\tassert(d >= 1 && d <= r - 1);\n\tassert(tmp >= 0 && tmp <= d - 1);\n\tassert(Di >= 0 && Dj <= D.length);\n\tassert(Qi >= 0);\n\tassert(Dj - Di <= Q.length - Qi);\n\n\twhile (Di < Dj) {\n\t\ttmp *= r;\n\t\ttmp += D[Di];\n\n\t\tQ[Qi] = (tmp / d) | 0;\n\t\ttmp %= d;\n\n\t\t++Qi;\n\t\t++Di;\n\t}\n}\n","import assert from 'assert';\n\nimport _zeros from '../../array/_zeros.js';\nimport _copy from '../../array/_copy.js';\nimport _mul_limb from '../mul/_mul_limb.js';\nimport jz from '../../../api/compare/jz.js';\nimport _idivmod_schoolbook_large_divisor from './_idivmod_schoolbook_large_divisor.js';\nimport _div_limb_with_prefix from './_div_limb_with_prefix.js';\n\n/**\n * Computes q <- a / b and a <- a % b.\n * No leading zeros allowed.\n * q has length at least aj - ai\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend / Remainder.\n * @param {Number} ai\n * @param {Number} aj\n * @param {Array} b Divisor.\n * @param {Number} bi\n * @param {Number} bj\n * @param {Array} q Quotient.\n * @param {Number} qi\n */\nexport default function _idivmod_schoolbook(r, a, ai, aj, b, bi, bj, q, qi) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(qi >= 0);\n\tassert(q.length - qi >= aj - ai);\n\tassert(aj - ai <= 0 || a[ai] !== 0); // No leading zero\n\tassert(bj - bi >= 1 && b[bi] !== 0); // No leading zero\n\tassert(jz(q, qi, qi + aj - ai));\n\n\tconst _r = Math.ceil(r / 2);\n\tconst x = b[bi];\n\n\tif (x < _r) {\n\t\t// We need x to be >= _r so we multiply b by ceil( _r / x )\n\t\t// this gives us <= ( 1 + _r / x ) b < r^(bj-bi)\n\t\t// (this can be implemented faster using bit shifts if r = 2^k )\n\t\tconst z = Math.ceil(_r / x);\n\t\tconst m = aj - ai + 1;\n\t\tconst n = bj - bi;\n\n\t\tconst _a = _zeros(m);\n\t\t_mul_limb(r, z, a, ai, aj, _a, 0, m);\n\n\t\tconst _b = _zeros(n);\n\t\t_mul_limb(r, z, b, bi, bj, _b, 0, n);\n\n\t\tconst _q = _zeros(m);\n\t\t_idivmod_schoolbook_large_divisor(r, _a, 0, m, _b, 0, n, _q, 0);\n\t\t_div_limb_with_prefix(r, _a[0], z, _a, 1, m, a, ai);\n\t\t_copy(_q, 1, m, q, qi);\n\t} else _idivmod_schoolbook_large_divisor(r, a, ai, aj, b, bi, bj, q, qi);\n}\n","import assert from 'assert';\n\n/**\n * Multiply b by x where x is a single limb.\n *\n * Also works when x === r (by accident, needed for extensive test of\n * _convert_dc). In that case we check that r*(r-1) <= 2^53 - 1.\n * Maximum possible value for this to work is r = 94906266.\n *\n * TODO define constant. Reuse elsewhere?\n */\nexport default function _imul_limb(r, x, b, bi, bj) {\n\tassert(r >= 2);\n\tassert(r <= 94_906_266);\n\tassert(x >= 0 && x <= r);\n\tassert(bi >= 0 && bj <= b.length);\n\n\tlet C = 0;\n\n\twhile (--bj >= bi) {\n\t\tconst t = b[bj] * x + C;\n\n\t\tb[bj] = t % r;\n\n\t\tC = (t / r) | 0;\n\t}\n}\n","const THRESHOLD_MUL_TOOM22 = 16;\nexport default THRESHOLD_MUL_TOOM22;\n","import THRESHOLD_MUL_TOOM22 from './THRESHOLD_MUL_TOOM22.js';\n\nconst THRESHOLD_DIV_DC = 8 * THRESHOLD_MUL_TOOM22;\nexport default THRESHOLD_DIV_DC;\n","import assert from 'assert';\n\n/**\n * Computes the product of two big endian arrays using schoolbook\n * multiplication. |C| >= |A|+|B|.\n *\n * TODO Can this be optimized if we know that |A| >= |B|?\n * Probably better to do many small passes rather than few large passes ?!\n * This is what this implementation achieves, although it returns correct\n * results even when |A| < |B|.\n */\n\nexport default function _schoolbook_mul(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(cj - ci >= aj - ai + (bj - bi));\n\n\tconst m = aj - ai;\n\tconst n = bj - bi;\n\t--aj;\n\t--bj;\n\t--cj;\n\n\tfor (let i = 0; i < m; ++i) {\n\t\tlet q = 0;\n\n\t\tfor (let j = 0; j < n; ++j) {\n\t\t\t// T will never exceed (r-1) * (r+1) = r^2 - 1\n\t\t\t// We must have r^2 - 1 <= 2^53 - 1\n\t\t\t// Hence r <= 2^{53/2} = 94906265.62425156.\n\t\t\t// Hence r <= 94906265.\n\t\t\tconst t = c[cj - i - j] + q + a[aj - i] * b[bj - j];\n\t\t\tc[cj - i - j] = t % r;\n\t\t\tq = (t / r) | 0; // Will never exceed r-1\n\t\t}\n\n\t\tc[cj - i - n] = q;\n\t}\n}\n","import assert from 'assert';\nimport _zeros from '../../array/_zeros.js';\nimport _iadd from '../add/_iadd.js';\nimport _mul from './_mul.js';\n\n/**\n *\n * Multiply two big endian arrays using karatsuba algorithm,\n * WHEN THE SECOND OPERAND IS SMALL.\n * |A| >= |B| >= 1, |C| >= |A| + |B|, |A| >= 2, Math.ceil(|A|/2) >= |B|.\n *\n * /!\\ BLOCK MULTIPLICATION RESULT MUST HOLD IN THE JAVASCRIPT NUMBER TYPE\n *     (DOUBLE i.e. 53 bits)\n *\n * EXPLANATION\n * ###########\n *\n * We consider the numbers a and b0. a has size N = 2n, and b0 has size n.\n *\n * We divide a into its lower and upper parts.\n *\n * a = a1 r^{n} + a0 (1)\n *\n * We express the product of a and b0 using these.\n *\n * a b0 = (a1 r^{n} + a0) b0 (3)\n *      = a1 b0 r^{n} + a0 b0 (4)\n *\n * This gives us 2 multiplications with operands of size n.\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {Array} c result, must be 0 initialized\n * @param {Number} ci c left\n * @param {Number} cj c right\n */\n\nexport default function _karatsuba_right_op_is_small(\n\tr,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n\tc,\n\tci,\n\tcj,\n) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(aj - ai >= 2);\n\tassert(bj - bi >= 1);\n\tassert(aj - ai >= bj - bi);\n\tassert(cj - ci >= aj - ai + (bj - bi));\n\n\tconst i = aj - ai;\n\tconst j = bj - bi;\n\n\tconst n = Math.ceil(i / 2);\n\n\tassert(j <= n);\n\n\tconst N = n + j;\n\tconst N_ = i - n + j;\n\tconst i_ = aj - n;\n\n\tconst z = _zeros(N_); // Need tmp variable since _mul overwrites\n\n\t// RECURSIVE CALLS\n\t_mul(r, a, i_, aj, b, bi, bj, c, cj - N, cj); // C += a0.b0\n\t_mul(r, a, ai, i_, b, bi, bj, z, 0, N_); // Z = a1.b0\n\n\t_iadd(r, c, ci, cj - n, z, 0, N_); // C += a1.b0 . r^{n}\n}\n","import assert from 'assert';\nimport add from '../../../api/arithmetic/add/add.js';\nimport iadd from '../../../api/arithmetic/add/iadd.js';\nimport _zeros from '../../array/_zeros.js';\nimport _copy from '../../array/_copy.js';\nimport _isub from '../sub/_isub.js';\nimport _mul from './_mul.js';\nimport _karatsuba_right_op_is_small from './_karatsuba_right_op_is_small.js';\n\n/**\n *\n * Multiply two big endian arrays using karatsuba algorithm,\n * |A| >= |B| >= 1, |C| >= |A| + |B|, |A| >= 2.\n *\n * /!\\ BLOCK MULTIPLICATION RESULT MUST HOLD IN THE JAVASCRIPT NUMBER TYPE\n *     (DOUBLE i.e. 53 bits)\n *\n * EXPLANATION\n * ###########\n *\n * We consider the numbers a and b, both of size N = 2n.\n *\n * We divide a and b into their lower and upper parts.\n *\n * a = a1 r^{n} + a0 (1)\n * b = b1 r^{n} + b0 (2)\n *\n * We express the product of a and b using their lower and upper parts.\n *\n * a b = (a1 r^{n} + a0) (b1 r^{n} + b0) (3)\n *     = a1 b1 r^{2n} + (a1 b0 + a0 b1) r^{n} + a0 b0 (4)\n *\n * This gives us 4 multiplications with operands of size n.\n * Using a simple trick, we can reduce this computation to 3 multiplications.\n *\n * We give the 3 terms of (4) the names z0, z1 and z2.\n *\n * z2 = a1 b1\n * z1 = a1 b0 + a0 b1\n * z0 = a0 b0\n *\n * a b  = z2 r^{2n} + z1 r^{n} + z0\n *\n * We then express z1 using z0, z2 and one additional multiplication.\n *\n * (a1 + a0)(b1 + b0) = a1 b1 + a0 b0 + (a1 b0 + a0 b1)\n *                    = z2 + z0 + z1\n *\n * z1 = (a1 + a0)(b1 + b0) - z2 - z0\n *\n * AN ANOTHER WAY AROUND (not used here)\n *\n * (a1 - a0)(b1 - b0) = (a1 b1 + a0 b0) - (a1 b0 + a0 b1)\n * (a0 - a1)(b1 - b0) = (a1 b0 + a0 b1) - (a1 b1 + a0 b0)\n * a b = (r^{2n} + r^{n})a1 b1 + r^{n}(a0 - a1)(b1 - b0) + (r^{n} + 1)a0 b0\n *\n * This algorithm is a specific case of the Toom-Cook algorithm, when m = n =\n * 2.\n *\n * For further reference, see\n *  - http://en.wikipedia.org/wiki/Karatsuba_algorithm\n *  - http://en.wikipedia.org/wiki/Toom–Cook_multiplication\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {Array} c result, must be 0 initialized\n * @param {Number} ci c left\n * @param {Number} cj c right\n */\n\nexport default function _karatsuba(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(aj - ai >= 2);\n\tassert(bj - bi >= 1);\n\tassert(aj - ai >= bj - bi);\n\tassert(cj - ci >= aj - ai + (bj - bi));\n\n\tconst i = aj - ai;\n\tconst j = bj - bi;\n\n\tconst n = Math.ceil(i / 2);\n\n\tif (j <= n)\n\t\treturn _karatsuba_right_op_is_small(r, a, ai, aj, b, bi, bj, c, ci, cj);\n\n\tconst I = i + j;\n\tconst N = 2 * n;\n\tconst N_ = I - N;\n\tconst i_ = aj - n;\n\tconst j_ = bj - n;\n\n\tconst t1 = _zeros(n + 1); // + 1 to handle addition overflows\n\tconst t2 = _zeros(n + 1); // And guarantee reducing k for the\n\tconst t3 = _zeros(N + 2); // Recursive calls\n\tconst z2 = _zeros(N_);\n\tconst z0 = _zeros(N);\n\n\t// RECURSIVE CALLS\n\t_mul(r, a, ai, i_, b, bi, j_, z2, 0, N_); // Z2 = a1.b1\n\t_mul(r, a, i_, aj, b, j_, bj, z0, 0, N); // Z0 = a0.b0\n\tadd(r, a, ai, i_, a, i_, aj, t1, 0, n + 1); // (a0 + a1)\n\tadd(r, b, bi, j_, b, j_, bj, t2, 0, n + 1); // (b1 + b0)\n\t_mul(r, t1, 1, n + 1, t2, 1, n + 1, t3, 2, N + 2); // (a0 + a1)(b1 + b0)\n\n\t// BUILD OUTPUT\n\t_copy(z2, 0, N_, c, cj - I); // + z2 . r^{2n}\n\t_copy(z0, 0, N, c, cj - N); // + z0\n\n\t// overflow on t1, add t2 . r^{n}\n\tif (t1[0]) iadd(r, t3, 0, n + 2, t2, 0, n + 1);\n\n\t// Overflow on t2, add t1 . r^{n} (except t1[0])\n\tif (t2[0]) iadd(r, t3, 0, n + 2, t1, 1, n + 1);\n\n\tiadd(r, c, ci, cj - n, t3, 0, N + 2); // + (a0 + a1)(b1 + b0) . r^{n}\n\t_isub(r, c, ci, cj - n, z2, 0, N_); // - z2 . r^{n}\n\t_isub(r, c, ci, cj - n, z0, 0, N); // - z1 . r^{n}\n}\n","import assert from 'assert';\nimport THRESHOLD_MUL_TOOM22 from '../../thresholds/THRESHOLD_MUL_TOOM22.js';\nimport _mul_limb from './_mul_limb.js';\nimport _schoolbook_mul from './_schoolbook_mul.js';\nimport _karatsuba from './_karatsuba.js';\n\n/**\n * Computes C = A+B.\n *\n * Constraints:\n *   - C is zero initialized,\n *   - |A| >= |B| >= 0,\n *   - |C| >= |A| + |B|.\n *\n * TODO:\n *   - Use schoolbook mul if n = O(log m).\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand, cannot have more limbs than A\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {Array} c result, must be 0 initialized and be able to contain A+B\n * @param {Number} ci c left\n * @param {Number} cj c right\n */\nexport default function _mul(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(bj - bi >= 0);\n\tassert(aj - ai >= bj - bi);\n\tassert(cj - ci >= aj - ai + (bj - bi));\n\tassert(THRESHOLD_MUL_TOOM22 >= 1);\n\n\t// Const m = aj - ai ;\n\tconst n = bj - bi;\n\n\t// TODO then |B| = 1 and could be faster\n\t// if ( m === 1 ) return _mul_limb( r , a[ai] , b , bi , bj , c , ci , cj ) ;\n\n\tif (n === 1) return _mul_limb(r, b[bi], a, ai, aj, c, ci, cj);\n\n\t// If ( m === n ) {\n\n\t// if ( a === b && ai === bi ) return _sqr( r , a , ai , aj , c , ci , cj ) ;\n\n\t// return _mul_n( r , a , ai , aj , b , bi , bj , c , ci , cj ) ;\n\n\t// }\n\n\tif (n < THRESHOLD_MUL_TOOM22) {\n\t\treturn _schoolbook_mul(r, a, ai, aj, b, bi, bj, c, ci, cj);\n\t}\n\n\treturn _karatsuba(r, a, ai, aj, b, bi, bj, c, ci, cj);\n}\n","import assert from 'assert';\n\n/**\n * Subtracts 1 from a big endian array.\n *\n * Wraps on underflow. Hence, does nothing if aj <= ai.\n *\n * O(|A|) time in the worst case.\n * O(1) amortized time over any number of successive operations starting with A = O(1).\n * O(1) amortized time over O(|A|) successive operations starting with any A.\n *\n * @param {Number} r radix\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n */\nexport default function decrement(r, a, ai, aj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\n\twhile (--aj >= ai) {\n\t\tif (a[aj] > 0) {\n\t\t\t--a[aj];\n\t\t\treturn;\n\t\t}\n\n\t\ta[aj] = r - 1;\n\t}\n}\n","import assert from 'assert';\n\nimport _zeros from '../../array/_zeros.js';\nimport _fill from '../../array/_fill.js';\nimport _isub from '../sub/_isub.js';\nimport _mul from '../mul/_mul.js';\nimport lt from '../../../api/compare/lt.js';\nimport iadd from '../../../api/arithmetic/add/iadd.js';\nimport decrement from '../../../api/arithmetic/sub/decrement.js';\nimport _cmp_half from '../../compare/_cmp_half.js';\nimport _idivmod_dc_21 from './_idivmod_dc_21.js';\n\n/**\n * Algorithm 3.4 Divide-and-conquer division (3 by 2)\n * ==================================================\n *\n * Input\n * -----\n *  Two nonnegative integers A and B,\n *  such that A < β^n B and β^{2n} / 2 ≤ B < β^{2n}.\n *  n must be even.\n *\n *                    --------                 -----\n *                   |  |  |  |               |  |  |\n *                    --------                 -----\n *\n * Output\n * ------\n *  The quotient floor( A/B ) and the remainder A mod B.\n *\n * Complexity\n * ----------\n *  T'(n) ≤ T(n) + M(n) + Ln\n *\n */\nexport default function _idivmod_dc_32(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(cj - ci === aj - ai);\n\tassert(2 * (aj - ai) === 3 * (bj - bi)); // Implies bj - bi even\n\tassert(_cmp_half(r, b, bi, bj) >= 0);\n\n\t// 1. Let A = A_2 β^{2n} + A_1 β^n + A_0 and\n\t//    B = B_1 β^{n} + B_0,\n\t//    with 0 ≤ A_i < β^n and 0 ≤ B_i < β^n.\n\n\tconst k = bj - bi;\n\tconst n = k >>> 1;\n\n\t// 2. If A_2 < B_1, compute Q = floor( ( A_2 β^n + A_1 ) / B_1 ) with\n\t//    remainder R_1 using algorithm 3.3;\n\n\tif (lt(a, ai, ai + n, b, bi, bi + n)) {\n\t\t_idivmod_dc_21(r, a, ai, aj - n, b, bi, bi + n, c, ci + n, cj);\n\t}\n\n\t//    Otherwise let Q = β^n - 1, and R_1 = ( A_2 - B_1 ) β^n + A_1 + B_1\n\t//    (note in this case that A_2 = B_1)\n\telse {\n\t\t_fill(c, cj - n, cj, r - 1);\n\t\tiadd(r, a, ai, aj - n, b, bi, bi + n);\n\t\t_isub(r, a, ai, ai + n, b, bi, bi + n);\n\t}\n\n\t// 3. R <- R_1 β^n + A_0 - Q*B_0\n\n\tconst zi = 0;\n\tconst zj = n << 1;\n\tconst z = _zeros(zj);\n\t_mul(r, c, cj - n, cj, b, bi + n, bj, z, zi, zj);\n\t_isub(r, a, ai, aj, z, zi, zj); // TODO optimize when A_2 = B_1\n\n\t// 4. if R < 0 , R <- R + B and Q <- Q - 1\n\n\tif (a[ai] === 0) return;\n\tiadd(r, a, ai, aj, b, bi, bj);\n\tdecrement(r, c, cj - n, cj);\n\n\t// 5. if R < 0 , R <- R + B and Q <- Q - 1\n\n\tif (a[ai] === 0) return;\n\tiadd(r, a, ai, aj, b, bi, bj);\n\tdecrement(r, c, cj - n, cj);\n\n\t// 6. Return Q and R\n}\n","import assert from 'assert';\n\nimport THRESHOLD_DIV_DC from '../../thresholds/THRESHOLD_DIV_DC.js';\nimport _cmp_half from '../../compare/_cmp_half.js';\nimport _idivmod_dc_32 from './_idivmod_dc_32.js';\nimport _idivmod_schoolbook_large_divisor from './_idivmod_schoolbook_large_divisor.js';\n\n/**\n * Algorithm 3.3 Divide-and-conquer division (2 by 1)\n * ==================================================\n *\n * Input\n * -----\n *  Two nonnegative integers A and B,\n *  such that A < β^n B and β^n / 2 ≤ B < β^n.\n *  n must be even if n >= THRESHOLD_DIV_DC.\n *\n *                    -----------                 -----\n *                   |  :  |  :  |               |  :  |\n *                    -----------                 -----\n *\n * Output\n * ------\n *  The quotient floor( A/B ) and the remainder A mod B.\n *\n * Complexity\n * ----------\n *  T(n) = 2T'(n/2) + K\n *\n */\nexport default function _idivmod_dc_21(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(THRESHOLD_DIV_DC >= 2);\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(cj - ci === aj - ai);\n\tassert(aj - ai === 2 * (bj - bi));\n\tassert(_cmp_half(r, b, bi, bj) >= 0);\n\n\tif (bj - bi < THRESHOLD_DIV_DC) {\n\t\treturn _idivmod_schoolbook_large_divisor(r, a, ai, aj, b, bi, bj, c, ci);\n\t}\n\n\tassert((bj - bi) % 2 === 0);\n\n\t// 1. Let A = A_3 β^{3n/2} + A_2 β^n + A_1 β^{n/2} + A_0 and\n\t//    B = B_1 β^{n/2} + B_0,\n\t//    with 0 ≤ A_i < β^{n/2} and 0 ≤ B_i < β^{n/2}.\n\n\tconst m = aj - ai;\n\tconst k = m >>> 2;\n\n\t// 2. Compute the high half Q_1 of the quotient as\n\t//    Q_1 = ( A_3 β^n + A_2 β^{n/2} + A_1 ) / B\n\t//    with remainder R_1 using algorithm 3.4.\n\n\t_idivmod_dc_32(r, a, ai, aj - k, b, bi, bj, c, ci, cj - k);\n\n\t// 3. Compute the low half Q_0 of the quotient as\n\t//    Q_0 = ( R_1 β^{n/2} + A_0 ) / B\n\t//    with remainder R_0 using algorithm 3.4.\n\n\t_idivmod_dc_32(r, a, ai + k, aj, b, bi, bj, c, ci + k, cj);\n\n\t// 4. Return the quotient Q = Q_1 β^{n/2} + Q_0 and the remainder R = R_0 .\n}\n","import assert from 'assert';\n\n/**\n * Divides a big endian number by a single limb number and returns only the\n * remainder.\n *\n * Only works with limbs of size at most sqrt( 2^53 ).\n *\n * @param {Number} r The radix of D.\n * @param {Number} d The divisor >= 1.\n * @param {Array} D The dividend (NOT modified).\n * @param {Number} Di Left of D.\n * @param {Number} Dj Right of D.\n * @returns {Number} The remainder D % d.\n */\nexport default function _mod_limb(r, d, D, Di, Dj) {\n\tassert(r >= 2);\n\tassert(d >= 1 && d <= r - 1);\n\tassert(Di >= 0 && Dj <= D.length);\n\n\tlet R = 0;\n\n\twhile (Di < Dj) {\n\t\tR *= r;\n\t\tR += D[Di];\n\t\tR %= d;\n\t\t++Di;\n\t}\n\n\treturn R;\n}\n","import assert from 'assert';\n\nimport _zeros from '../../array/_zeros.js';\nimport _copy from '../../array/_copy.js';\nimport _cmp_n from '../../compare/_cmp_n.js';\nimport _imul_limb from '../mul/_imul_limb.js';\nimport jz from '../../../api/compare/jz.js';\nimport _idivmod_dc_21 from './_idivmod_dc_21.js';\nimport _div_limb_with_prefix from './_div_limb_with_prefix.js';\nimport _mod_limb from './_mod_limb.js';\n\n/**\n * Input\n * -----\n *  - No leading zeros\n *  - |A| = |C|\n *  - C must be zero-initialized.\n *\n * References\n * ----------\n *   - https://gmplib.org/manual/Divide-and-Conquer-Division.html\n *\n * @param {Number} X The radix.\n * @param {Array} a Dividend / Remainder.\n * @param {Number} ai\n * @param {Number} aj\n * @param {Array} b Divisor.\n * @param {Number} bi\n * @param {Number} bj\n * @param {Array} c Quotient.\n * @param {Number} ci\n * @param {Number} cj\n */\nexport default function _idivmod_dc(X, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(X >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(aj - ai <= 0 || a[ai] !== 0);\n\tassert(bj - bi >= 1);\n\tassert(b[bi] !== 0);\n\tassert(cj - ci === aj - ai);\n\n\tassert(jz(c, ci, cj));\n\n\t// [BZ98] Fast Recursive Division\n\n\tconst r = aj - ai;\n\tconst s = bj - bi;\n\n\t// NB: this is the only case where c needs to be zero-initialized.\n\tif (r < s || (r === s && _cmp_n(a, ai, aj, b, bi) < 0)) return;\n\n\t// Shift to get n = 2^k for some k\n\tlet _n = 1;\n\n\twhile (_n < s) _n <<= 1;\n\n\tconst n = _n;\n\n\tconst shift = n - s;\n\n\tconst x = b[bi];\n\tconst _X = X / 2;\n\tconst _normalize = x < _X;\n\tconst z = Math.ceil(_X / x);\n\n\tconst w = r + shift + (_normalize || a[ai] >= _X);\n\tconst t = Math.ceil(w / n);\n\tconst _ai = 0;\n\tconst _aj = t * n; // + 1 if\n\tconst _a = _zeros(_aj); // Potential normalization overflow\n\tconst _ak = _aj - shift - r; // Or if A potentially bigger than B\n\t_copy(a, ai, aj, _a, _ak);\n\n\tconst _bi = 0;\n\tconst _bj = n;\n\tconst _b = _zeros(n);\n\t_copy(b, bi, bj, _b, 0);\n\n\tif (_normalize) {\n\t\t_imul_limb(X, z, _a, _ai, _aj);\n\t\t_imul_limb(X, z, _b, _bi, _bj);\n\t}\n\n\tconst _cj = _aj;\n\tconst _c = _zeros(_cj);\n\n\tfor (let i = 0; i < _aj - n; i += n) {\n\t\t_idivmod_dc_21(X, _a, i, i + (n << 1), _b, _bi, _bj, _c, i, i + (n << 1));\n\t}\n\n\tif (_normalize) {\n\t\tconst p = _mod_limb(X, z, _a, _ai, _ak);\n\t\t_div_limb_with_prefix(X, p, z, _a, _ak, _aj - shift, a, ai);\n\t} else {\n\t\t_copy(_a, _ak, _aj - shift, a, ai);\n\t}\n\n\t// C is completely overwritten here\n\t_copy(_c, _cj - r, _cj, c, ci);\n}\n","import assert from 'assert';\n\nimport _idivmod_limb from '../../../core/arithmetic/div/_idivmod_limb.js';\nimport _idivmod_schoolbook from '../../../core/arithmetic/div/_idivmod_schoolbook.js';\nimport _idivmod_dc from '../../../core/arithmetic/div/_idivmod_dc.js';\nimport THRESHOLD_DIV_DC from '../../../core/thresholds/THRESHOLD_DIV_DC.js';\nimport jz from '../../compare/jz.js';\n\n/**\n * Computes the quotient and remainder of two numbers. Uses the most\n * appropriate algorithm depending on the size of the operands. The remainder\n * is written to the dividend array. There are a few assumptions made on the\n * input.\n *\n * Input\n * -----\n *  - |d| >= 1\n *  - |D| = |Q| >= 1\n *  - No leading zeros in D or d.\n *  - Q is zero initialized.\n *\n * @param {Number} r The base to work with.\n * @param {Array} D Dividend / Remainder array (remainder computed in-place).\n * @param {Number} Di Left of dividend.\n * @param {Number} Dj Right of dividend.\n * @param {Array} d Divisor array.\n * @param {Number} di Left of divisor.\n * @param {Number} dj Right of divisor.\n * @param {Array} Q Quotient array (zero initialized).\n * @param {Number} Qi Left of quotient.\n * @param {Number} Qj Right of quotient.\n */\nexport default function _idivmod(r, D, Di, Dj, d, di, dj, Q, Qi, Qj) {\n\tassert(r >= 2);\n\n\tassert(Di >= 0 && Dj <= D.length);\n\tassert(di >= 0 && dj <= d.length);\n\tassert(Qi >= 0 && Qj <= Q.length);\n\n\tassert(dj - di >= 1);\n\tassert(Dj - Di === Qj - Qi);\n\tassert(Qj - Qi >= 1);\n\n\tassert(D[Di] !== 0);\n\tassert(d[di] !== 0);\n\tassert(jz(Q, Qi, Qj));\n\n\tconst dn = dj - di;\n\n\tif (dn === 1) {\n\t\treturn _idivmod_limb(r, d[di], D, Di, Dj, Q, Qi);\n\t}\n\n\tif (dn < THRESHOLD_DIV_DC) {\n\t\treturn _idivmod_schoolbook(r, D, Di, Dj, d, di, dj, Q, Qi);\n\t}\n\n\treturn _idivmod_dc(r, D, Di, Dj, d, di, dj, Q, Qi, Qj);\n}\n","import _copy from '../../../core/array/_copy.js';\nimport _idivmod from './_idivmod.js';\n\n/**\n * Computes the quotient and remainder of two numbers. Uses the most\n * appropriate algorithms depending on the size of the operands. The remainder\n * is written to the dividend array. There are a few assumptions made on the\n * input.\n *\n * Input\n * -----\n *  - No leading zeros in D or Q.\n *  - |D| = |Q| = |R|\n *\n * @param {Number} r The base to work with.\n * @param {Array} D Dividend array.\n * @param {Number} Di Left of dividend.\n * @param {Number} Dj Right of dividend.\n * @param {Array} d Divisor array.\n * @param {Number} di Left of divisor.\n * @param {Number} dj Right of divisor.\n * @param {Array} Q Quotient array.\n * @param {Number} Qi Left of quotient.\n * @param {Number} Qj Right of quotient.\n * @param {Array} R Remainder array.\n * @param {Number} Ri Left of remainder.\n * @param {Number} Rj Right of remainder.\n */\nexport default function _divmod(r, D, Di, Dj, d, di, dj, Q, Qi, Qj, R, Ri, Rj) {\n\t_copy(D, Di, Dj, R, Rj - (Dj - Di));\n\n\t_idivmod(r, R, Ri, Rj, d, di, dj, Q, Qi, Qj);\n}\n","import assert from 'assert';\n\n/**\n * Divides a big endian number by a single limb number and writes the\n * remainder to the dividend array.\n *\n * Computes a <- a % b.\n * Only works with limbs of size at most sqrt( 2^53 ).\n *\n * @param {Number} r The radix of D.\n * @param {Number} d The divisor >= 1.\n * @param {Array} D The dividend.\n * @param {Number} Di Left of D.\n * @param {Number} Dj Right of D.\n */\nexport default function _imod_limb(r, d, D, Di, Dj) {\n\tassert(r >= 2);\n\tassert(d >= 1 && d <= r - 1);\n\tassert(Di >= 0 && Dj <= D.length);\n\tassert(Dj - Di >= 1);\n\n\tlet R = 0;\n\n\twhile (Di < Dj) {\n\t\tR *= r;\n\t\tR += D[Di];\n\t\tR %= d;\n\t\tD[Di] = 0;\n\t\t++Di;\n\t}\n\n\tD[Dj - 1] = R;\n}\n","import assert from 'assert';\n\nimport _zeros from '../../array/_zeros.js';\nimport gt from '../../../api/compare/gt.js';\nimport _isub from '../sub/_isub.js';\nimport _mul_limb from '../mul/_mul_limb.js';\n\nimport _cmp_half from '../../compare/_cmp_half.js';\n\n/**\n * Input\n * -----\n *  - Two integers A and B such that 0 <= A < B * β and (β^n)/2 <= B < β^n.\n *    (Hence B >= 1).\n *  - |A| = |B| + 1\n *\n * Output\n * -----\n *  The remainder A mod B.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend.\n * @param {Number} ai Left of dividend.\n * @param {Number} aj Right of dividend.\n * @param {Array} b Divisor.\n * @param {Number} bi Left of divisor.\n * @param {Number} bj Right of divisor.\n */\nexport default function _imod_schoolbook_subroutine_do(\n\tr,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai === bj - bi + 1); // |a| = |b| + 1\n\tassert(_cmp_half(r, b, bi, bj) >= 0); // (r^n)/2 <= B < r^n\n\tassert(gt(b, bi, bj, a, ai, aj - 1)); // A < B * β\n\n\tconst m = aj - ai;\n\n\t// Since A < B*β, then A/B < β\n\t// q <- min [ ( β a_0 + a_1 ) / b_0 , β - 1 ]\n\tconst _q = Math.min(r - 1, Math.floor((a[ai] * r + a[ai + 1]) / b[bi]));\n\n\t// Fix _q\n\tconst T = _zeros(m);\n\t_mul_limb(r, _q, b, bi, bj, T, 0, m);\n\n\tif (gt(T, 0, m, a, ai, aj)) {\n\t\t// --_q ;\n\t\t_isub(r, T, 0, m, b, bi, bj);\n\n\t\tif (gt(T, 0, m, a, ai, aj)) {\n\t\t\t// --_q ;\n\t\t\t_isub(r, T, 0, m, b, bi, bj);\n\t\t}\n\t}\n\n\t_isub(r, a, ai, aj, T, 0, m);\n}\n","import assert from 'assert';\n\nimport _cmp_half from '../../compare/_cmp_half.js';\nimport _cmp_n from '../../compare/_cmp_n.js';\nimport _isub from '../sub/_isub.js';\nimport _imod_schoolbook_subroutine_do from './_imod_schoolbook_subroutine_do.js';\n\n/**\n * Input\n * -----\n *  - Two integers A and B such that 0 <= A < β^(n+1) and (β^n)/2 <= B < β^n.\n *  - |A| = |B| + 1\n *\n * Output\n * -----\n *  The remainder A mod B.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend.\n * @param {Number} ai Left of dividend.\n * @param {Number} aj Right of dividend.\n * @param {Array} b Divisor.\n * @param {Number} bi Left of divisor.\n * @param {Number} bj Right of divisor.\n */\nexport default function _imod_schoolbook_subroutine(r, a, ai, aj, b, bi, bj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai === bj - bi + 1); // |A| = |B| + 1\n\tassert(_cmp_half(r, b, bi, bj) >= 0); // (β^n)/2 <= B < β^n\n\n\t// If A ≥ B*β, compute the remainder r of ( A − B*β ) / B\n\t// and return it.\n\t// Note that then A − B*β < B*β since A < 2 B*β because of the\n\t// preconditions above. Hence the preconditions hold for\n\t// _imod_schoolbook_subroutine_do.\n\tif (_cmp_n(a, ai, aj - 1, b, bi) >= 0) {\n\t\t_isub(r, a, ai, aj - 1, b, bi, bj);\n\t}\n\n\t_imod_schoolbook_subroutine_do(r, a, ai, aj, b, bi, bj);\n}\n","import assert from 'assert';\n\nimport _trim_positive from '../../convert/_trim_positive.js';\nimport lt from '../../../api/compare/lt.js';\nimport _isub from '../sub/_isub.js';\nimport _cmp_half from '../../compare/_cmp_half.js';\nimport _imod_schoolbook_subroutine from './_imod_schoolbook_subroutine.js';\n\n/**\n * Input\n * -----\n *  - Two integers A and B such that r^(m-1) <= A < r^m and (r^n)/2 <= B < r^(n).\n *  - No leading zeros (ONLY IN B?)\n *\n * Output\n * -----\n *  The remainder A mod B.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend.\n * @param {Number} ai Left of dividend.\n * @param {Number} aj Right of dividend.\n * @param {Array} b Divisor.\n * @param {Number} bi Left of divisor.\n * @param {Number} bj Right of divisor.\n */\nexport default function _imod_schoolbook_large_divisor(\n\tr,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\t// Assert(aj - ai <= 0 || a[ai] !== 0); // no leading zero NOT TRUE ?\n\tassert(_cmp_half(r, b, bi, bj) >= 0); // (r^n)/2 <= B < r^n (+ no leading zero)\n\n\twhile (true) {\n\t\t// Non-recursive\n\n\t\tconst m = aj - ai;\n\t\tconst n = bj - bi;\n\n\t\t// If m < n, return the remainder A.\n\t\tif (m < n) return;\n\n\t\tif (m === n) {\n\t\t\t// If m = n, then if A < B, return the remainder A;\n\t\t\tif (lt(a, ai, aj, b, bi, bj)) return;\n\n\t\t\t// If A ≥ B, return the remainder A - B.\n\t\t\t_isub(r, a, ai, aj, b, bi, bj);\n\t\t\treturn;\n\t\t}\n\n\t\t// If m = n + 1, compute the remainder of A/B\n\t\t// using algorithm 3.1 and return them.\n\t\tif (m === n + 1)\n\t\t\treturn _imod_schoolbook_subroutine(r, a, ai, aj, b, bi, bj);\n\n\t\t// 4. A' <- A/β^{m-n-1} and s <- A mod β^{m-n-1}\n\t\tconst _aj = ai + n + 1;\n\n\t\t// 5. Compute the remainder r' of A'/B using algorithm 3.1.\n\t\t_imod_schoolbook_subroutine(r, a, ai, _aj, b, bi, bj);\n\n\t\t// 6. Compute the remainder r of( β^{m-n-1} r' + s ) / B recursively.\n\t\tconst ak = _trim_positive(a, ai, _aj);\n\t\t// _imod_schoolbook_large_divisor( r , a , ak , aj , b , bi , bj ) ;\n\t\t// non recursive because some implementation\n\t\tai = ak; // Do not have tail-call optimization ?\n\n\t\t// 7. Return the remainder R = r\n\t}\n}\n","import assert from 'assert';\n\nimport _zeros from '../../array/_zeros.js';\nimport _mul_limb from '../mul/_mul_limb.js';\nimport _imod_schoolbook_large_divisor from './_imod_schoolbook_large_divisor.js';\nimport _div_limb_with_prefix from './_div_limb_with_prefix.js';\n\n/**\n * Divides a big endian number by another big endian number and writes the\n * remainder to the dividend array.\n *\n * Computes a <- a % b.\n * No leading zeros allowed.\n *\n * @param {Number} r The radix.\n * @param {Array} a Dividend / Remainder.\n * @param {Number} ai\n * @param {Number} aj\n * @param {Array} b Divisor.\n * @param {Number} bi\n * @param {Number} bj\n */\nexport default function _imod_schoolbook(r, a, ai, aj, b, bi, bj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai <= 0 || a[ai] !== 0); // No leading zero\n\tassert(bj - bi >= 1 && b[bi] !== 0); // No leading zero\n\n\tconst _r = Math.ceil(r / 2);\n\tconst x = b[bi];\n\n\tif (x < _r) {\n\t\t// We need x to be >= _r so we multiply b by ceil( _r / x )\n\t\t// this gives us <= ( 1 + _r / x ) b < r^(bj-bi)\n\t\t// (this can be implemented faster using bit shifts if r = 2^k )\n\t\tconst z = Math.ceil(_r / x);\n\t\tconst m = aj - ai + 1;\n\t\tconst n = bj - bi;\n\n\t\tconst _a = _zeros(m);\n\t\t_mul_limb(r, z, a, ai, aj, _a, 0, m);\n\n\t\tconst _b = _zeros(n);\n\t\t_mul_limb(r, z, b, bi, bj, _b, 0, n);\n\n\t\t_imod_schoolbook_large_divisor(r, _a, 0, m, _b, 0, n);\n\t\t_div_limb_with_prefix(r, _a[0], z, _a, 1, m, a, ai);\n\t} else _imod_schoolbook_large_divisor(r, a, ai, aj, b, bi, bj);\n}\n","import assert from 'assert';\n\nimport _reset from '../../../core/array/_reset.js';\nimport _imod_limb from '../../../core/arithmetic/div/_imod_limb.js';\nimport _imod_schoolbook from '../../../core/arithmetic/div/_imod_schoolbook.js';\nimport _idivmod_dc from '../../../core/arithmetic/div/_idivmod_dc.js';\nimport THRESHOLD_DIV_DC from '../../../core/thresholds/THRESHOLD_DIV_DC.js';\n\n/**\n * Computes the remainder of two numbers. Uses the most\n * appropriate algorithm depending on the size of the operands. The remainder\n * is written to the dividend array. There are a few assumptions made on the\n * input.\n *\n * Input\n * -----\n *  - |d| >= 1\n *  - |D| = |_| >= 1\n *  - No leading zeros in D or d.\n *\n * @param {Number} r The base to work with.\n * @param {Array} D Dividend / Remainder array (remainder computed in-place).\n * @param {Number} Di Left of dividend.\n * @param {Number} Dj Right of dividend.\n * @param {Array} d Divisor array.\n * @param {Number} di Left of divisor.\n * @param {Number} dj Right of divisor.\n * @param {Array} _ Additional memory array.\n * @param {Number} _i Left of memory.\n * @param {Number} _j Right of memory.\n */\nexport default function _imod(r, D, Di, Dj, d, di, dj, _, _i, _j) {\n\tassert(r >= 2);\n\n\tassert(Di >= 0 && Dj <= D.length);\n\tassert(di >= 0 && dj <= d.length);\n\tassert(_i >= 0 && _j <= _.length);\n\n\tassert(dj - di >= 1);\n\tassert(Dj - Di === _j - _i);\n\tassert(_j - _i >= 1);\n\n\tassert(D[Di] !== 0);\n\tassert(d[di] !== 0);\n\n\tconst dn = dj - di;\n\n\tif (dn === 1) {\n\t\treturn _imod_limb(r, d[di], D, Di, Dj);\n\t}\n\n\tif (dn < THRESHOLD_DIV_DC) {\n\t\treturn _imod_schoolbook(r, D, Di, Dj, d, di, dj);\n\t}\n\n\t_reset(_, _i, _j);\n\treturn _idivmod_dc(r, D, Di, Dj, d, di, dj, _, _i, _j);\n}\n","import cmp from './cmp.js';\n\n/**\n * Compares two big endian arrays: returns true if the first is greater or\n * equal to the second.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {boolean} true iff A >= B.\n */\nconst ge = (a, ai, aj, b, bi, bj) => cmp(a, ai, aj, b, bi, bj) >= 0;\nexport default ge;\n","import assert from 'assert';\n\nimport _imod from '../../../api/arithmetic/div/_imod.js';\nimport ge from '../../../api/compare/ge.js';\nimport _alloc from '../../array/_alloc.js';\nimport _trim_positive from '../../convert/_trim_positive.js';\n\n/**\n * Euclidean algorithm. Computes the gcd of the two input numbers A and B,\n * A >= B. Input arrays are modified ___in-place___.\n *\n * Input\n * -----\n *\n *   - A >= B\n *   - No leading zeros\n *\n * @param {Number} r The radix.\n * @param {Array} a The first input number A.\n * @param {Number} ai Left of A.\n * @param {Number} aj Right of A.\n * @param {Array} b The second input number B.\n * @param {Number} bi Left of B.\n * @param {Number} bj Right of B.\n * @returns {Array} The array containing the gcd of A and B (one of A and B).\n * Return as [ d , di , dj ], where d is the array and di and dj are its left\n * and right bounds.\n */\nexport default function _euclidean_algorithm_loop(r, a, ai, aj, b, bi, bj) {\n\tassert(r >= 2);\n\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\n\tassert(aj - ai <= 0 || a[ai] !== 0);\n\tassert(bj - bi <= 0 || b[bi] !== 0);\n\n\tassert(ge(a, ai, aj, b, bi, bj));\n\n\tconst _j = aj - ai;\n\tconst _ = _alloc(_j);\n\n\twhile (true) {\n\t\tif (bi === bj) return [a, ai, aj];\n\n\t\t_imod(r, a, ai, aj, b, bi, bj, _, _j - (aj - ai), _j);\n\n\t\tai = _trim_positive(a, aj - (bj - bi), aj);\n\n\t\tif (ai === aj) return [b, bi, bj];\n\n\t\t_imod(r, b, bi, bj, a, ai, aj, _, _j - (bj - bi), _j);\n\n\t\tbi = _trim_positive(b, bj - (aj - ai), bj);\n\t}\n}\n","import _trim_positive from '../../../core/convert/_trim_positive.js';\nimport _alloc from '../../../core/array/_alloc.js';\nimport _copy from '../../../core/array/_copy.js';\n\nimport _cmp_n from '../../../core/compare/_cmp_n.js';\nimport _euclidean_algorithm_loop from '../../../core/arithmetic/gcd/_euclidean_algorithm_loop.js';\n\n/**\n * No constraints on the input.\n *\n * @param {Number} r The radix.\n * @param {Array} a First input number <code>a>b</code>.\n * @param {Number} ai <code>a</code> left bound.\n * @param {Number} aj <code>a</code> right bound.\n * @param {Array} b Second input number <code>b<a</code>.\n * @param {Number} bi <code>b</code> left bound.\n * @param {Number} bj <code>b</code> right bound.\n * @returns {Array} The array containing the gcd of A and B (one of A and B).\n * Return as [ d , di , dj ], where d is the array and di and dj are its left\n * and right bounds.\n */\nexport default function euclidean_algorithm(r, a, ai, aj, b, bi, bj) {\n\tconst _ai = _trim_positive(a, ai, aj);\n\tconst _bi = _trim_positive(b, bi, bj);\n\tconst m = aj - _ai;\n\tconst n = bj - _bi;\n\n\tconst R0 = _alloc(m);\n\t_copy(a, _ai, aj, R0, 0);\n\tconst R1 = _alloc(n);\n\t_copy(b, _bi, bj, R1, 0);\n\n\treturn m > n || (m === n && _cmp_n(R0, 0, m, R1, 0) >= 0)\n\t\t? _euclidean_algorithm_loop(r, R0, 0, m, R1, 0, n)\n\t\t: _euclidean_algorithm_loop(r, R1, 0, n, R0, 0, m);\n}\n","import assert from 'assert';\n\nimport _alloc from '../../array/_alloc.js';\nimport _zeros from '../../array/_zeros.js';\n\n/**\n * M >= n >= 0\n * m >= 1\n */\nexport default function _extended_euclidean_algorithm_allocate(m, n) {\n\tassert(n >= 0);\n\tassert(m >= 1);\n\tassert(m >= n);\n\n\tconst R0 = _alloc(m);\n\tconst R1 = _alloc(n);\n\n\t// S_0 = 1\n\tconst S0 = _zeros(Math.max(1, n));\n\tS0[S0.length - 1] = 1;\n\n\t// T_0 = 0\n\tconst T0 = _zeros(m);\n\n\t// S_1 = 0\n\tconst S1 = _zeros(n);\n\n\t// T_1 = 1\n\tconst T1 = _zeros(m);\n\tT1[T1.length - 1] = 1;\n\n\tconst Q = _zeros(m);\n\tconst X = _zeros(2 * m);\n\n\treturn [R0, R1, S0, T0, S1, T1, Q, X];\n}\n","import assert from 'assert';\nimport _mul from '../../../core/arithmetic/mul/_mul.js';\n\n/**\n *  Multiplies two big endian arrays and puts result in a destination array.\n *\n *  Constraints:\n *  - C is zero initialized,\n *  - |A| >= 0,\n *  - |B| >= 0,\n *  - |C| >= |A| + |B|.\n *\n * @param {Number} r base (radix)\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {Array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {Array} c result, must be 0 initialized and be able to contain result\n * @param {Number} ci c left\n * @param {Number} cj c right\n *\n */\nexport default function mul(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(aj - ai >= 0);\n\tassert(bj - bi >= 0);\n\tassert(cj - ci >= aj - ai + (bj - bi));\n\n\t// TODO Truncate input if output is too small (see api/add)?\n\n\treturn aj - ai >= bj - bi\n\t\t? _mul(r, a, ai, aj, b, bi, bj, c, ci, cj)\n\t\t: _mul(r, b, bi, bj, a, ai, aj, c, ci, cj);\n}\n","import assert from 'assert';\n\nimport _idivmod from '../../../api/arithmetic/div/_idivmod.js';\nimport mul from '../../../api/arithmetic/mul/mul.js';\nimport _iadd from '../add/_iadd.js';\nimport increment from '../../../api/arithmetic/add/increment.js';\nimport _reset from '../../array/_reset.js';\nimport _copy from '../../array/_copy.js';\n\nimport _trim_positive from '../../convert/_trim_positive.js';\n\nimport ge from '../../../api/compare/ge.js';\n\n/**\n * Extended Euclidean algorithm.\n *\n * @see https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm\n *\n * Given two input integers a and b, a > b.\n * Let r_0 = a, r_1 = b,\n *     s_0 = 1, s_1 = 0,\n *     t_0 = 0, t_1 = 1 (Fibonacci :winkemoji:).\n *\n * Let r_{i+1} = r_{i-1} % r_i             (division remainder)\n * Let q_i = (r_{i-1} - r_{i+1}) / r_i > 0 (division quotient)\n *\n * An alternative definition is\n * r_{i+1} = r_{i-1} - q_i r_i       (with 0 <= r_{i+1} < r_i)\n *\n * Then define\n * s_{i+1} = s_{i-1} - q_i s_i\n * t_{i+1} = t_{i-1} - q_i t_i\n *\n * Let k be such that r_i > 0 for all i <= k and r_{k+1} = 0.\n *\n * Since q_i > 0, if t_{i-1} > 0 and t_i < 0 then t_{i+1} > 0. On the other\n * hand, if t_{i-1} < 0 and t_i > 0 then t_{i+1} < 0. Note that t_2 < 0, so the\n * signs of the t_i alternate: t_0 = 0, t_1 = 1, t_2 < 0, t_3 > 0, t_4 < 0, t_5\n * > 0, etc. The pattern for t is 0, 1, -, +, -, +, -, etc.\n *\n * The same holds for the s_i with flipped signs: note that s_2 = 1, then\n * s_0 = 1, s_1 = 0, s_2 = 1, s_3 < 0, s_4 > 0, s_5 < 0, etc.\n * The pattern for s is 1, 0, 1, -, +, -, +, etc.\n *\n *   | 0  1  2  3  4  5  6\n * ------------------------\n * s | 1  0  1  -  +  -  +\n * t | 0  1  -  +  -  +  -\n *\n * With i >= 1, |t_{i+1}| >= |t_i| + |t_{i-1}| > |t_i| because q_i >= 1 and\n * |t_i| > 0 and, since the signs are alternating, we have |t_{i-1} - q_i t_i|\n * = |t_{i-1}| + |q_i t_i|. Same goes for s_{i+1} w.r.t s_i and s_{i-1}.\n *\n *\n * Input\n * -----\n *  - No leading zeroes\n *  - R0 >= R1\n *  - (two bullets above imply |R1| >= |R0|)\n *  - More at _extended_euclidean_algorithm_allocate.\n *\n *\n * Implementation details\n * ----------------------\n *\n * Here the implementation avoids computing with negative numbers and will only\n * output the absolute value of s_{i} and t_{i}. The signs can be recovered\n * from the number of steps of the algorithm.\n *\n * Note that s_i <= b and t_i <= a (proof?). Equality holds\n * when i = k+1 and a and b are coprime. Thus s_i can sit in an array as large\n * as b and same for t_i and a.\n *\n * Output\n * ------\n *\n *  Calling this function returns the number of steps that were executed.\n *\n */\nexport default function _extended_euclidean_algorithm_loop(\n\tr,\n\tR0,\n\tR1,\n\tS0,\n\tT0,\n\tS1,\n\tT1,\n\tQ,\n\tX,\n) {\n\tassert(r >= 2);\n\n\tconst m = R0.length;\n\tconst n = R1.length;\n\n\tlet R0i = 0;\n\tconst R0j = m;\n\tlet R1i = 0;\n\tconst R1j = n;\n\tlet S0i = S0.length - 1;\n\tconst S0j = S0.length;\n\tlet T0i = m;\n\tconst T0j = m;\n\tlet S1i = n;\n\tconst S1j = n;\n\tlet T1i = m - 1;\n\tconst T1j = m;\n\tlet Qi = 0;\n\tconst Qj = m;\n\tlet Xi = 0;\n\tconst Xj = 2 * m;\n\n\tassert(R0i >= 0 && R0j <= R0.length);\n\tassert(R0j - R0i <= 0 || R0[R0i] !== 0);\n\tassert(R1i >= 0 && R1j <= R1.length);\n\tassert(R1j - R1i <= 0 || R1[R1i] !== 0);\n\n\tassert(ge(R0, R0i, R0j, R1, R1i, R1j));\n\n\t// We handle the first two steps outside of loop because s_1 = t_0 = 0\n\t// and s_1 = 0, s_2 = 1\n\n\t// Invariants\n\t// ----------\n\t//\n\t// 1. No leading zeros in R0\n\t// 2. No leading zeros in R1\n\t// 3. |Q| = |R0| (why ???)\n\tassert(Qj - Qi === R0j - R0i);\n\t// 4. s_0 = S0 > 0\n\t// 5. s_1 = S1 < 0\n\t// 6. t_0 = T0 < 0\n\t// 7. t_1 = T1 > 0\n\n\tif (R1i === R1j) return [R0i, S0i, T0i, S1i, T1i, 1];\n\n\t// Q_1 = (r_0 - r_2) / r_1\n\t// R0 is r_0 and becomes r_2\n\t// R1 is r_1\n\t// Q is q_1\n\t_idivmod(r, R0, R0i, R0j, R1, R1i, R1j, Q, Qi, Qj);\n\n\t// Remove leading zeros from Q\n\t// since Q = R0 / R1 we have |R0| - |R1| <= |Q| <= |R0| - |R1| + 1\n\tQi = Qj - (R0j - R1j + 1); // R0i = R1i = 0\n\tif (Q[Qi] === 0) ++Qi;\n\tassert(Qi < Qj && Q[Qi] !== 0);\n\n\t// Remove leading zeros from R0\n\t// since R0 = R0 % R1 we have |R0| <= |R1|\n\tR0i = _trim_positive(R0, R0j - (R1j - R1i), R0j);\n\n\t// S_2 = s_0 - q_1 * s_1 = s_0\n\t// S0 is s_0 and becomes s_2 i.e. NOTHING TO DO\n\n\t// t_2 = t_0 - q_1 * t_1 = q_1\n\t// T0 is t_0 and becomes t_2\n\tT0i = T0j - (Qj - Qi);\n\t_copy(Q, Qi, Qj, T0, T0i);\n\n\t// Invariants\n\t// ----------\n\t//\n\t// 1. No leading zeros in R0\n\tassert(R0i >= 0 && R0j <= R0.length);\n\tassert(R0j - R0i <= 0 || R0[R0i] !== 0);\n\t// 2. No leading zeros in R1\n\tassert(R1i >= 0 && R1j <= R1.length);\n\tassert(R1j - R1i <= 0 || R1[R1i] !== 0);\n\t// 3. |Q| = |R1| (why ???)\n\t// assert(Qj - Qi === R1j - R1i); // NOT TRUE !\n\t// 4. s_1 = S1 < 0\n\t// 5. s_2 = S0 > 0\n\t// 6. t_1 = T1 > 0\n\t// 7. t_2 = T0 < 0\n\n\tif (R0i === R0j) return [R1i, S0i, T0i, S1i, T1i, 2];\n\n\t// Q_2 = (r_1 - r_{i+1}) / r_2\n\t// R1 is r_1 and becomes r_3\n\t// R0 is r_2\n\t// Q is q_2\n\tQi = Qj - (R1j - R1i);\n\t_reset(Q, Qi, Qj);\n\t_idivmod(r, R1, R1i, R1j, R0, R0i, R0j, Q, Qi, Qj);\n\n\t// Remove leading zeros from Q\n\t// since Q = R1 / R0 we have |R1| - |R0| <= |Q| <= |R1| - |R0| + 1\n\tQi = Qj - (R1j - R0j + R0i + 1); // R1i = 0\n\tif (Q[Qi] === 0) ++Qi;\n\tassert(Qi < Qj && Q[Qi] !== 0);\n\n\t// Remove leading zeros from R1\n\t// since R1 = R1 % R0 we have |R1| <= |R0|\n\tR1i = _trim_positive(R1, R1j - (R0j - R0i), R1j);\n\n\t// S_3 = s_1 - q_2 * s_2 = -q_2\n\tS1i = S1j - (Qj - Qi);\n\t_copy(Q, Qi, Qj, S1, S1i);\n\n\t// Q_2 * t_2\n\t// since Q and T0 have no leading zeros then\n\t// Q * T0 has |Q| + |T0| - 1 <= |Q*T0| <= |Q| + |T0| limbs with no leading zeros.\n\tXi = Xj - (Qj - Qi) - (T0j - T0i);\n\tmul(r, T0, T0i, T0j, Q, Qi, Qj, X, Xi, Xj);\n\t// T_3 = t_1 - q_2 * t_2 = 1 - q_2 * t_2\n\t// T1 is t_1 and becomes t_3\n\tincrement(r, X, Xi, Xj);\n\tXi = _trim_positive(X, Xi, Xj);\n\tT1i = T1j - (Xj - Xi);\n\t_copy(X, Xi, Xj, T1, T1i);\n\n\tlet steps = 3;\n\twhile (true) {\n\t\t// Invariants\n\t\t// ----------\n\t\t//\n\t\t// 1. No leading zeros in R0\n\t\tassert(R0i >= 0 && R0j <= R0.length);\n\t\tassert(R0j - R0i <= 0 || R0[R0i] !== 0);\n\t\t// 2. No leading zeros in R1\n\t\tassert(R1i >= 0 && R1j <= R1.length);\n\t\tassert(R1j - R1i <= 0 || R1[R1i] !== 0);\n\t\t// 3. |Q| = |R0| (why ???)\n\t\t// 4. s_{i-1} = S0 > 0\n\t\t// 5. s_i = S1 < 0\n\t\t// 6. t_{i-1} = T0 < 0\n\t\t// 7. t_i = T1 > 0\n\n\t\tif (R1i === R1j) return [R0i, S0i, T0i, S1i, T1i, steps];\n\t\t++steps;\n\n\t\t// Q_i = (r_{i-1} - r_{i+1}) / r_i\n\t\t// R0 is r_{i-1} and becomes r_{i+1}\n\t\t// R1 is r_i\n\t\t// Q is q_i\n\t\tQi = Qj - (R0j - R0i);\n\t\t_reset(Q, Qi, Qj);\n\t\t_idivmod(r, R0, R0i, R0j, R1, R1i, R1j, Q, Qi, Qj);\n\t\t// Remove leading zeros from Q\n\t\t// since Q = R0 / R1 we have |R0| - |R1| <= |Q| <= |R0| - |R1| + 1\n\t\tQi = Qj - (R0j - R0i - R1j + R1i + 1);\n\t\tif (Q[Qi] === 0) ++Qi;\n\t\tassert(Qi < Qj && Q[Qi] !== 0);\n\t\t// Remove leading zeros from R0\n\t\t// since R0 = R0 % R1 we have |R0| <= |R1|\n\t\tR0i = _trim_positive(R0, R0j - (R1j - R1i), R0j);\n\n\t\t// Q_i * s_i\n\t\t// since Q and S1 have no leading zeros then\n\t\t// Q * S1 has |Q| + |S1| - 1 <= |Q*S1| <= |Q| + |S1| limbs with no leading zeros.\n\t\tXi = Xj - (Qj - Qi) - (S1j - S1i);\n\t\t_reset(X, Xi, Xj);\n\t\tmul(r, Q, Qi, Qj, S1, S1i, S1j, X, Xi, Xj);\n\t\tif (X[Xi] === 0) ++Xi; // Remove leading zero if no carry\n\n\t\t// s_{i+1} = s_{i-1} - q_i * s_i\n\t\t// S0 is s_{i-1} and becomes s_{i+1}\n\t\tS0i = S0j - (Xj - Xi + 1);\n\t\tS0i = Math.max(0, S0i); // Next addition never overflows beyond bounds\n\t\t_iadd(r, S0, S0i, S0j, X, Xi, Xj);\n\t\tif (S0[S0i] === 0) ++S0i;\n\n\t\t// Q_i * t_i\n\t\t// since Q and T1 have no leading zeros then\n\t\t// Q * T1 has |Q| + |T1| - 1 <= |Q*T1| <= |Q| + |T1| limbs with no leading zeros.\n\t\tXi = Xj - (Qj - Qi) - (T1j - T1i);\n\t\t_reset(X, Xi, Xj);\n\t\tmul(r, Q, Qi, Qj, T1, T1i, T1j, X, Xi, Xj);\n\t\tif (X[Xi] === 0) ++Xi; // Remove leading zero if no carry\n\n\t\t// t_{i+1} = t_{i-1} - q_i * t_i\n\t\t// T0 is t_{i-1} and becomes t_{i+1}\n\t\tT0i = T0j - (Xj - Xi + 1);\n\t\tT0i = Math.max(0, T0i); // Next addition never overflows beyond bounds\n\t\t_iadd(r, T0, T0i, T0j, X, Xi, Xj);\n\t\tif (T0[T0i] === 0) ++T0i;\n\n\t\t// Invariants\n\t\t// ----------\n\t\t//\n\t\t// 1. No leading zeros in R0\n\t\tassert(R0i >= 0 && R0j <= R0.length);\n\t\tassert(R0j - R0i <= 0 || R0[R0i] !== 0);\n\t\t// 2. No leading zeros in R1\n\t\tassert(R1i >= 0 && R1j <= R1.length);\n\t\tassert(R1j - R1i <= 0 || R1[R1i] !== 0);\n\t\t// 3. |Q| = |R1| (why ???)\n\t\t// 4. s_{i-1} = S1 < 0\n\t\t// 5. s_i = S0 > 0\n\t\t// 6. t_{i-1} = T1 > 0\n\t\t// 7. t_i = T0 < 0\n\n\t\tif (R0i === R0j) return [R1i, S0i, T0i, S1i, T1i, steps];\n\t\t++steps;\n\n\t\t// Q_i = (r_{i-1} - r_{i+1}) / r_i\n\t\t// R1 is r_{i-1} and becomes r_{i+1}\n\t\t// R0 is r_i\n\t\t// Q is q_i\n\t\tQi = Qj - (R1j - R1i);\n\t\t_reset(Q, Qi, Qj);\n\t\t_idivmod(r, R1, R1i, R1j, R0, R0i, R0j, Q, Qi, Qj);\n\t\t// Remove leading zeros from Q\n\t\t// since Q = R1 / R0 we have |R1| - |R0| <= |Q| <= |R1| - |R0| + 1\n\t\tQi = Qj - (R1j - R1i - R0j + R0i + 1);\n\t\tif (Q[Qi] === 0) ++Qi;\n\t\tassert(Qi < Qj && Q[Qi] !== 0);\n\t\t// Remove leading zeros from R1\n\t\t// since R1 = R1 % R0 we have |R1| <= |R0|\n\t\tR1i = _trim_positive(R1, R1j - (R0j - R0i), R1j);\n\n\t\t// Q_i * s_i\n\t\t// since Q and S0 have no leading zeros then\n\t\t// Q * S0 has |Q| + |S0| - 1 <= |Q*S0| <= |Q| + |S0| limbs with no leading zeros.\n\t\tXi = Xj - (Qj - Qi) - (S0j - S0i);\n\t\t_reset(X, Xi, Xj);\n\t\tmul(r, Q, Qi, Qj, S0, S0i, S0j, X, Xi, Xj);\n\t\tif (X[Xi] === 0) ++Xi; // Remove leading zero if no carry\n\n\t\t// s_{i+1} = s_{i-1} - q_i * s_i\n\t\t// S1 is s_{i-1} and becomes s_{i+1}\n\t\tS1i = S1j - (Xj - Xi + 1);\n\t\tS1i = Math.max(0, S1i); // Next addition never overflows beyond bounds\n\t\t_iadd(r, S1, S1i, S1j, X, Xi, Xj);\n\t\tif (S1[S1i] === 0) ++S1i;\n\n\t\t// Q_i * t_i\n\t\t// since Q and T0 have no leading zeros then\n\t\t// Q * T0 has |Q| + |T0| - 1 <= |Q*T0| <= |Q| + |T0| limbs with no leading zeros.\n\t\tXi = Xj - (Qj - Qi) - (T0j - T0i);\n\t\t_reset(X, Xi, Xj);\n\t\tmul(r, Q, Qi, Qj, T0, T0i, T0j, X, Xi, Xj);\n\t\tif (X[Xi] === 0) ++Xi; // Remove leading zero if no carry\n\n\t\t// t_{i+1} = t_{i-1} - q_i * t_i\n\t\t// T1 is t_{i-1} and becomes t_{i+1}\n\t\tT1i = T1j - (Xj - Xi + 1);\n\t\tT1i = Math.max(0, T1i); // Next addition never overflows beyond bounds\n\t\t_iadd(r, T1, T1i, T1j, X, Xi, Xj);\n\t\tif (T1[T1i] === 0) ++T1i;\n\t}\n}\n","import assert from 'assert';\n\nimport _copy from '../../array/_copy.js';\nimport ge from '../../../api/compare/ge.js';\n\nimport _extended_euclidean_algorithm_allocate from './_extended_euclidean_algorithm_allocate.js';\nimport _extended_euclidean_algorithm_loop from './_extended_euclidean_algorithm_loop.js';\n\n/**\n * Precondition:\n *   - A >= B\n *   - No leading zeroes.\n *\n * @param {Number} r The radix.\n * @param {Array} a First input number <code>a>b</code>.\n * @param {Number} ai <code>a</code> left bound.\n * @param {Number} aj <code>a</code> right bound.\n * @param {Array} b Second input number <code>b<a</code>.\n * @param {Number} bi <code>b</code> left bound.\n * @param {Number} bj <code>b</code> right bound.\n */\n\nexport default function _extended_euclidean_algorithm(r, a, ai, aj, b, bi, bj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai <= 0 || a[ai] !== 0);\n\tassert(bj - bi <= 0 || b[bi] !== 0);\n\tassert(ge(a, ai, aj, b, bi, bj));\n\n\tconst [R0, R1, S0, T0, S1, T1, Q, X] = _extended_euclidean_algorithm_allocate(\n\t\taj - ai,\n\t\tbj - bi,\n\t);\n\n\t_copy(a, ai, aj, R0, 0);\n\t_copy(b, bi, bj, R1, 0);\n\n\tconst [Ri, S0i, T0i, S1i, T1i, steps] = _extended_euclidean_algorithm_loop(\n\t\tr,\n\t\tR0,\n\t\tR1,\n\t\tS0,\n\t\tT0,\n\t\tS1,\n\t\tT1,\n\t\tQ,\n\t\tX,\n\t);\n\n\treturn steps % 2 === 1\n\t\t? [R0, Ri, S0, S0i, T0, T0i, S1, S1i, T1, T1i, steps]\n\t\t: [R1, Ri, S1, S1i, T1, T1i, S0, S0i, T0, T0i, steps];\n}\n","import _trim_positive from '../../../core/convert/_trim_positive.js';\nimport _cmp_n from '../../../core/compare/_cmp_n.js';\nimport _extended_euclidean_algorithm from '../../../core/arithmetic/gcd/_extended_euclidean_algorithm.js';\n\n/**\n * No constraints on the input.\n *\n * @param {Number} r The radix.\n * @param {Array} a First input number <code>a>b</code>.\n * @param {Number} ai <code>a</code> left bound.\n * @param {Number} aj <code>a</code> right bound.\n * @param {Array} b Second input number <code>b<a</code>.\n * @param {Number} bi <code>b</code> left bound.\n * @param {Number} bj <code>b</code> right bound.\n */\nexport default function extended_euclidean_algorithm(r, a, ai, aj, b, bi, bj) {\n\tconst _ai = _trim_positive(a, ai, aj);\n\tconst _bi = _trim_positive(b, bi, bj);\n\tconst m = aj - _ai;\n\tconst n = bj - _bi;\n\n\tif (m > n || (m === n && _cmp_n(a, _ai, aj, b, _bi) >= 0))\n\t\treturn _extended_euclidean_algorithm(r, a, _ai, aj, b, _bi, bj);\n\n\tconst [R0, R0i, T0, T0i, S0, S0i, T1, T1i, S1, S1i, steps] =\n\t\t_extended_euclidean_algorithm(r, b, _bi, bj, a, _ai, aj);\n\n\treturn [R0, R0i, S0, S0i, T0, T0i, S1, S1i, T1, T1i, steps + 1];\n}\n","import cmp from './cmp.js';\n\n/**\n * Tests whether two big endian arrays are equal.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {boolean} true iff A = B.\n */\nconst eq = (a, ai, aj, b, bi, bj) => cmp(a, ai, aj, b, bi, bj) === 0;\nexport default eq;\n","import cmp from './cmp.js';\n\n/**\n * Compares two big endian arrays: returns true if the first is less or equal\n * to the second.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {boolean} true iff A <= B.\n */\nconst le = (a, ai, aj, b, bi, bj) => cmp(a, ai, aj, b, bi, bj) <= 0;\nexport default le;\n","import cmp from './cmp.js';\n\n/**\n * Tests whether two big endian arrays are not equal.\n *\n * Input:\n *   - |A| >= 0\n *   - |B| >= 0\n *\n * @param {number[]} a first operand\n * @param {number} ai a left\n * @param {number} aj a right\n * @param {number[]} b second operand\n * @param {number} bi b left\n * @param {number} bj b right\n *\n * @return {boolean} true iff A != B.\n */\nconst ne = (a, ai, aj, b, bi, bj) => cmp(a, ai, aj, b, bi, bj) !== 0;\nexport default ne;\n","import THRESHOLD_MUL_TOOM22 from './THRESHOLD_MUL_TOOM22.js';\n\nconst THRESHOLD_CONVERT_DC = 256 * THRESHOLD_MUL_TOOM22;\nexport default THRESHOLD_CONVERT_DC;\n","import assert from 'assert';\n\nexport default function _log(x, y) {\n\tassert(y > 1);\n\n\tlet z = 0;\n\n\twhile (x >= y) {\n\t\tif (x % y) break;\n\t\tx /= y;\n\t\t++z;\n\t}\n\n\treturn [z, x];\n}\n","import assert from 'assert';\n\n/**\n *\n * @param {Number} br the base to convert to\n * @param {Number} z if ar is the base to convert to then log(ar) = z log(br)\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_to_smaller_fast(br, z, a, ai, aj, b, bi, bj) {\n\tassert(br >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= 0);\n\tassert(bj - bi >= 0);\n\n\tlet q;\n\tlet i;\n\tlet t;\n\n\tconst m = bj - bi;\n\tconst n = aj - ai;\n\n\t// Number of parts of first\n\t// destination block if incomplete\n\tconst r = m % z;\n\n\t// Number of complete blocks in destination\n\tq = (m / z) | 0;\n\n\t// Total number of blocks in destination\n\t// (complete ones + first if incomplete)\n\tconst w = q + !!r;\n\n\tif (n >= w) {\n\t\t// If source contains more than what\n\t\t// destination can handle set the effective\n\t\t// read start in source and set i to the correct\n\t\t// offset according to the size\n\t\t// (in destination blocks) of the\n\t\t// first source block if incomplete\n\t\tai = aj - w;\n\t\ti = (z - r) % z;\n\t} else {\n\t\t// If destination can contain more than\n\t\t// what is available in source then\n\t\t// compute the effective write start\n\t\t// in destination and set i to 0 because\n\t\t// all blocks will be complete\n\t\tbi = bj - n * z;\n\t\ti = 0;\n\t}\n\n\tfor (; ai < aj && bi < bj; ++ai) {\n\t\tq = a[ai];\n\t\tt = bi + z - 1 - i;\n\t\tbi += z - i;\n\t\tfor (; i < z; ++i) {\n\t\t\tb[t] = q % br; // Unpack source blocks\n\t\t\tq = (q / br) | 0; // Using modulo + quotient\n\t\t\t--t;\n\t\t}\n\n\t\ti = 0;\n\t}\n}\n","import assert from 'assert';\nimport _alloc from '../array/_alloc.js';\nimport _copy from '../array/_copy.js';\nimport _idivmod_limb from '../arithmetic/div/_idivmod_limb.js';\nimport _trim_positive from './_trim_positive.js';\n\n/**\n *\n * O(N^2). f > t.\n *\n * |A| >= 1\n * |B| is large enough to hold the result\n *\n * @param {Number} f the base to convert from\n * @param {Number} t the base to convert to\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_to_smaller_slow(f, t, a, ai, aj, b, bi, bj) {\n\tassert(f >= t);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= 1);\n\tassert(bj - bi >= aj - ai);\n\n\tlet batch = 1;\n\tlet shift = t;\n\tfor (; shift * t <= f; shift *= t, ++batch);\n\n\tconst m = aj - ai;\n\tlet q = _alloc(m);\n\tlet r = _alloc(m); // NOTE that this copy is unnecessary when\n\t_copy(a, ai, aj, r, 0); // Called from parse since we can discard it.\n\n\tlet i = 0;\n\n\twhile (true) {\n\t\t_idivmod_limb(f, shift, r, i, m, q, i);\n\n\t\tconst end = Math.max(bi, bj - batch);\n\t\tlet block = r[m - 1];\n\n\t\tdo {\n\t\t\tb[--bj] = block % t;\n\t\t\tblock = (block / t) | 0;\n\t\t} while (bj > end);\n\n\t\ti = _trim_positive(q, i, m);\n\t\tif (i === m) return;\n\n\t\t// _copy( q , i , m , r , i ) ;\n\t\tconst tmp = q;\n\t\tq = r;\n\t\tr = tmp;\n\t}\n}\n","import assert from 'assert';\n\nexport default function _build(base, number, data, n) {\n\tassert(typeof base === 'number');\n\tassert(typeof number === 'number');\n\tassert(n <= data.length);\n\n\tlet q = number;\n\tconst d = base;\n\n\twhile (q >= d) {\n\t\tdata[--n] = q % d;\n\t\tq = (q / d) | 0;\n\t}\n\n\tdata[--n] = q;\n\n\tassert(n >= 0);\n\treturn n;\n}\n","import assert from 'assert';\n\nimport jz from '../../../api/compare/jz.js';\nimport _reset from '../../array/_reset.js';\nimport _alloc from '../../array/_alloc.js';\nimport _copy from '../../array/_copy.js';\nimport _mul from '../mul/_mul.js';\n\n/**\n * Computes <code>pow(a,x) = a^x</code> using exponentiation by squaring.\n * Writes result to output array.\n *\n * /!\\ |A| >= 1, |C| >= 1, |C| >= |A| * x, |C| = 000...0\n *\n * @param {Number} r The base to work with.\n * @param {Number} x The power to raise <code>a</code> to.\n * @param {Array} a The base array.\n * @param {Number} ai <code>a</code> left.\n * @param {Number} aj <code>b</code> right.\n * @param {Array} c The output array.\n * @param {Number} ci <code>a</code> left.\n * @param {Number} cj <code>b</code> right.\n */\nexport default function _pow_double(r, x, a, ai, aj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(x >= 0);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(aj - ai >= 1);\n\tassert(cj - ci >= 1);\n\tassert(cj - ci >= (aj - ai) * x);\n\tassert(jz(c, ci, cj));\n\n\tc[cj - 1] = 1;\n\n\tif (x === 0) return;\n\n\tconst n = aj - ai;\n\n\t_copy(a, ai, aj, c, cj - n);\n\n\tif (x === 1) return;\n\n\tconst xbits = [];\n\n\tdo {\n\t\txbits.push(x & 1);\n\t\tx >>= 1;\n\t} while (x !== 1);\n\n\tconst d = _alloc(cj - ci);\n\tlet _n = n;\n\n\tdo {\n\t\tconst _m = _n;\n\t\t_n <<= 1;\n\t\t_reset(d, 0, _n);\n\t\t_mul(r, c, cj - _m, cj, c, cj - _m, cj, d, 0, _n); // TODO use squaring function here\n\t\tif (xbits.pop() === 0) _copy(d, 0, _n, c, cj - _n);\n\t\telse {\n\t\t\tconst _o = _n + n;\n\t\t\t_reset(c, cj - _o, cj);\n\t\t\t_mul(r, d, 0, _n, a, ai, aj, c, cj - _o, cj); // Largest must be put first\n\t\t\t_n = _o;\n\t\t}\n\t} while (xbits.length > 0);\n}\n","import assert from 'assert';\n\n/**\n * Adds single limb to a big endian array.\n * Wraps on overflow.\n *\n * Input:\n *   - |A| >= 1.\n *\n * @param {Number} r base (radix)\n * @param {Number} x limb to add\n * @param {Array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n */\n\nexport default function _iadd_limb(r, x, a, ai, aj) {\n\tassert(r >= 2);\n\tassert(x >= 0 && x <= r - 1);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(aj - ai >= 1);\n\n\tlet T = a[--aj] + x;\n\ta[aj] = T % r;\n\n\twhile (T >= r && --aj >= ai) {\n\t\tT = a[aj] + 1;\n\t\ta[aj] = T % r;\n\t}\n}\n","import assert from 'assert';\nimport _iadd_limb from '../arithmetic/add/_iadd_limb.js';\nimport _imul_limb from '../arithmetic/mul/_imul_limb.js';\n\n/**\n *\n * O(N^2). f < t.\n *\n * @param {Number} f the base to convert from\n * @param {Number} t the base to convert to\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_to_larger_slow(f, t, a, ai, aj, b, bi, bj) {\n\tassert(f >= 2);\n\tassert(f <= t);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= 0);\n\tassert(bj - bi >= 0);\n\n\tlet batch = 1;\n\tlet shift = f;\n\tfor (; shift * f <= t; shift *= f, ++batch);\n\n\tconst rounds = ((aj - ai) / batch) | 0;\n\tconst first = (aj - ai) % batch;\n\n\tif (first > 0) {\n\t\tlet w1 = a[ai];\n\t\tfor (let j = 1; j < first; ++j) {\n\t\t\tw1 *= f;\n\t\t\tw1 += a[ai + j];\n\t\t}\n\n\t\tb[bj - 1] = w1;\n\t}\n\n\tconst _ai = ai + first;\n\tlet _bi = bj - 1;\n\n\tfor (let i = 0; i < rounds; ++i) {\n\t\tif (b[_bi] !== 0 && _bi > bi) --_bi;\n\t\t_imul_limb(t, shift, b, _bi, bj);\n\t\tif (b[_bi] !== 0 && _bi > bi) --_bi;\n\t\tlet w = 0;\n\t\tlet j = _ai + i * batch;\n\t\tconst _end = j + batch;\n\t\tdo {\n\t\t\tw *= f;\n\t\t\tw += a[j];\n\t\t} while (++j < _end);\n\n\t\t_iadd_limb(t, w, b, _bi, bj);\n\t}\n}\n","import _convert_to_smaller_slow from './_convert_to_smaller_slow.js';\nimport _convert_to_larger_slow from './_convert_to_larger_slow.js';\n\n/**\n *\n * F != t\n *\n * @param {Number} f the base to convert from\n * @param {Number} t the base to convert to\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_slow(f, t, a, ai, aj, b, bi, bj) {\n\tif (f > t) return _convert_to_smaller_slow(f, t, a, ai, aj, b, bi, bj);\n\treturn _convert_to_larger_slow(f, t, a, ai, aj, b, bi, bj);\n}\n","import assert from 'assert';\nimport _build from '../array/_build.js';\nimport _alloc from '../array/_alloc.js';\nimport _zeros from '../array/_zeros.js';\nimport _reset from '../array/_reset.js';\nimport _copy from '../array/_copy.js';\nimport _iadd from '../arithmetic/add/_iadd.js';\nimport _mul from '../arithmetic/mul/_mul.js';\nimport _pow_double from '../arithmetic/pow/_pow_double.js';\nimport mul from '../../api/arithmetic/mul/mul.js';\nimport _convert_slow from './_convert_slow.js';\nimport _trim_positive from './_trim_positive.js';\n\n/**\n *\n * O(M(N) log N) where M(N) is multiplication time complexity.\n *\n *   - bj - bi >= log_t(f) * ( aj - ai ) ;\n *\n * Roughly, split number A into two halves A0 * f^l + A1. Convert A0 to B0 and\n * A1 to B1 recursively. Then multiply B0 by f^l in base t and finally add B1.\n *\n * This implementation is not recursive. It is iterative, and will call a\n * simpler subroutine for the base case.\n *\n * @param {Number} size_small_block the size of a small block\n * @param {Number} f the base to convert from\n * @param {Number} t the base to convert to\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_dc(\n\tsize_small_block,\n\tf,\n\tt,\n\ta,\n\tai,\n\taj,\n\tb,\n\tbi,\n\tbj,\n) {\n\tassert(f >= 2);\n\tassert(t >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\n\tconst n = aj - ai;\n\tconst m = bj - bi;\n\n\t// How many limbs of output needed per limb of input.\n\tconst logratio = Math.log(f) / Math.log(t);\n\tassert(m >= logratio * n);\n\n\t// Compute block sizes.\n\tconst size_small_block_converted = Math.ceil(logratio * size_small_block) | 0;\n\tconst full_small_blocks = (n / size_small_block) | 0;\n\tassert(full_small_blocks >= 2);\n\tconst size_first_small_block = n % size_small_block;\n\tconst size_first_small_block_converted =\n\t\tMath.ceil(logratio * size_first_small_block) | 0;\n\n\t// Memory can never exceed this since we rounded up and merging rounds\n\t// created less and less of these lost fractional limbs.\n\t// Need to add + 1 everywhere because when f and t have some common power,\n\t// that representation will need one extra bit. Since multiplication\n\t// algorithms cannot handle bounds gracefully in that case (they will\n\t// overwrite the left most block with a zero) we need to add some padding.\n\t// If you look at the mul/_mul calls, they will have 0-based indexing\n\t// whereas _iadd calls are 1-based.\n\t// Actually could exploit that to replace multiplication by shifting.\n\tlet _ti = size_first_small_block_converted\n\t\t? 1 + size_first_small_block_converted\n\t\t: 0;\n\tconst size_memory =\n\t\t_ti + full_small_blocks * (1 + size_small_block_converted);\n\tlet tmp1 = _zeros(size_memory);\n\tlet tmp2 = _alloc(size_memory);\n\n\tlet _ai = ai + size_first_small_block;\n\n\t// Convert first small block\n\tif (size_first_small_block > 0) {\n\t\t_convert_slow(f, t, a, ai, _ai, tmp1, 1, _ti);\n\t}\n\n\t// Convert full small blocks\n\twhile (_ai < aj) {\n\t\t_convert_slow(\n\t\t\tf,\n\t\t\tt,\n\t\t\ta,\n\t\t\t_ai,\n\t\t\t_ai + size_small_block,\n\t\t\ttmp1,\n\t\t\t_ti + 1,\n\t\t\t_ti + 1 + size_small_block_converted,\n\t\t);\n\t\t_ai += size_small_block;\n\t\t_ti += 1 + size_small_block_converted;\n\t}\n\n\t// NOW ALL SMALL BLOCKS ARE CONVERTED, LET US ADD THEM UP\n\n\t// k holds the current number of blocks\n\tlet k = full_small_blocks + (size_first_small_block > 0 ? 1 : 0);\n\n\t// X holds f^size_small_block\n\tlet x2 = _zeros(m);\n\tlet xi = _build(t, f, x2, m);\n\tconst _m = size_small_block * (m - xi);\n\tconst _x = _zeros(_m);\n\t_pow_double(t, size_small_block, x2, xi, m, _x, 0, _m); // Compute f^size_small_block\n\tconst _xi = _trim_positive(_x, 0, _m);\n\tlet x1 = _zeros(m);\n\txi = m - (_m - _xi);\n\t_copy(_x, _xi, _m, x1, xi);\n\txi = _trim_positive(x1, 0, m);\n\n\t// Size_block_converted\n\tlet sbc = size_small_block_converted;\n\n\t// Size_first_block_converted\n\tlet sfbc =\n\t\tsize_first_small_block_converted > 0\n\t\t\t? size_first_small_block_converted\n\t\t\t: size_small_block_converted;\n\n\twhile (k !== 2) {\n\t\tassert(k > 2);\n\n\t\t_reset(tmp2, 0, size_memory);\n\n\t\tconst extra = k & 1;\n\t\tconst pairs = k >> 1;\n\n\t\t// Merge first two pairs.\n\t\t// NB: the first block is the only one that can be partially empty.\n\t\tif (extra === 0) {\n\t\t\tconst _tj = 1 + sfbc;\n\t\t\tconst _tk = 1 + _tj + sbc;\n\t\t\tmul(t, x1, xi, m, tmp1, 1, _tj, tmp2, 0, _tk - 1);\n\t\t\t_iadd(t, tmp2, 1, _tk - 1, tmp1, 1 + _tj, _tk); // TODO cannot overflow ?\n\t\t\tsfbc += sbc;\n\t\t} else {\n\t\t\t_copy(tmp1, 1, sfbc + 1, tmp2, 1);\n\t\t}\n\n\t\tlet _ti = sfbc + 2 - extra;\n\n\t\tfor (let i = 2 - extra; i < pairs + 1; ++i) {\n\t\t\t// C = A f^l + B\n\t\t\tconst _tj = _ti + 1 + sbc;\n\t\t\tconst _tk = _tj + 1 + sbc;\n\t\t\tmul(t, x1, xi, m, tmp1, 1 + _ti, _tj, tmp2, _ti - i + 1, _tk - i);\n\t\t\t_iadd(t, tmp2, _ti - i + 2, _tk - i, tmp1, 1 + _tj, _tk);\n\t\t\t_ti = _tk;\n\t\t}\n\n\t\t// Update f^l to f^2l\n\t\tconst _xi = m - 2 * (m - xi);\n\t\t_reset(x2, _xi, m);\n\t\t_mul(t, x1, xi, m, x1, xi, m, x2, _xi, m); // TODO use squaring function here\n\t\txi = _trim_positive(x2, _xi, m);\n\n\t\t// Swap variables\n\t\tconst x3 = x1;\n\t\tx1 = x2;\n\t\tx2 = x3;\n\n\t\t// Swap variables\n\t\tconst tmp3 = tmp1;\n\t\ttmp1 = tmp2;\n\t\ttmp2 = tmp3;\n\n\t\tk = pairs + extra;\n\n\t\tsbc <<= 1;\n\t}\n\n\t// Only one pair left to merge. Merge directly into output.\n\t_reset(tmp2, 0, m + 1);\n\t// Needed to correct overestimated value for sfbc\n\tconst offset = _trim_positive(tmp1, 1, 1 + sfbc);\n\tmul(t, x1, xi, m, tmp1, offset, 1 + sfbc, tmp2, 0, m + 1);\n\t_iadd(t, tmp2, 1, m + 1, tmp1, 2 + sfbc, 2 + sfbc + sbc);\n\t_copy(tmp2, 1, m + 1, b, 0);\n}\n","import assert from 'assert';\nimport THRESHOLD_CONVERT_DC from '../thresholds/THRESHOLD_CONVERT_DC.js';\nimport _log from './_log.js';\nimport _convert_to_smaller_fast from './_convert_to_smaller_fast.js';\nimport _convert_to_smaller_slow from './_convert_to_smaller_slow.js';\nimport _convert_dc from './_convert_dc.js';\n\n/**\n *\n * @param {Number} f the base to convert from\n * @param {Number} t the base to convert to\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_to_smaller(f, t, a, ai, aj, b, bi, bj) {\n\tassert(f >= 2);\n\tassert(t >= 2);\n\tassert(f > t);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= 0);\n\tassert(bj - bi >= 0);\n\n\tconst [z, x] = _log(f, t);\n\n\tif (x === 1) return _convert_to_smaller_fast(t, z, a, ai, aj, b, bi, bj);\n\n\tif (aj - ai >= THRESHOLD_CONVERT_DC) {\n\t\t// TODO use better size_small_block to avoid degenerated small blocks\n\t\t// that slow down the execution\n\t\treturn _convert_dc(THRESHOLD_CONVERT_DC >> 1, f, t, a, ai, aj, b, bi, bj);\n\t}\n\n\treturn _convert_to_smaller_slow(f, t, a, ai, aj, b, bi, bj);\n}\n","import assert from 'assert';\n\n/**\n *\n * @param {Number} ar the base to convert from\n * @param {Number} z if br is the base to convert to then log(br) = z log(ar)\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_to_larger_fast(ar, z, a, ai, aj, b, bi, bj) {\n\tassert(ar >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= 0);\n\tassert(bj - bi >= 0);\n\n\tlet i;\n\tlet t;\n\n\tconst m = aj - ai;\n\tconst n = bj - bi;\n\n\t// Number of parts of first\n\t// destination block if incomplete\n\tconst r = m % z;\n\n\t// Number of complete blocks in destination\n\tconst q = (m / z) | 0;\n\n\t// Total number of blocks in destination\n\t// (complete ones + first if incomplete)\n\tconst w = q + !!r;\n\n\tif (n >= w) {\n\t\t// If destination can contain more than\n\t\t// what is available in source then\n\t\t// compute the effective write start\n\t\t// in destination and set i to the correct\n\t\t// offset according to the size\n\t\t// (in source blocks) of the\n\t\t// first destination block if incomplete\n\t\tbi = bj - w;\n\t\ti = (z - r) % z;\n\t} else {\n\t\t// If source contains more than what\n\t\t// destination can handle set the effective\n\t\t// read start in source and set i to 0 because\n\t\t// all blocks will be complete\n\t\tai = aj - n * z;\n\t\ti = 0;\n\t}\n\n\tfor (; ai < aj && bi < bj; ++bi) {\n\t\tt = 0;\n\t\tfor (; i < z; ++i) {\n\t\t\tt *= ar; // Aggregate source blocks\n\t\t\tt += a[ai]; // Using simple\n\t\t\t++ai; // Multiply + add\n\t\t}\n\n\t\tb[bi] = t; // Set block in destination\n\t\ti = 0;\n\t}\n}\n","import assert from 'assert';\nimport THRESHOLD_CONVERT_DC from '../thresholds/THRESHOLD_CONVERT_DC.js';\nimport _log from './_log.js';\nimport _convert_to_larger_fast from './_convert_to_larger_fast.js';\nimport _convert_to_larger_slow from './_convert_to_larger_slow.js';\nimport _convert_dc from './_convert_dc.js';\n\n/**\n *\n * @param {Number} f the base to convert from\n * @param {Number} t the base to convert to\n * @param {Array} a the origin array\n * @param {Number} ai start offset in the origin array\n * @param {Number} aj end offset in the origin array\n * @param {Array} b the destination array\n * @param {Number} bi start offset in the destination array\n * @param {Number} bj end offset in the destination array\n */\n\nexport default function _convert_to_larger(f, t, a, ai, aj, b, bi, bj) {\n\tassert(f >= 2);\n\tassert(t >= 2);\n\tassert(f < t);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(aj - ai >= 0);\n\tassert(bj - bi >= 0);\n\n\tconst [z, x] = _log(t, f);\n\n\tif (x === 1) return _convert_to_larger_fast(f, z, a, ai, aj, b, bi, bj);\n\n\tif (aj - ai >= THRESHOLD_CONVERT_DC) {\n\t\t// TODO use better size_small_block to avoid degenerated small blocks\n\t\t// that slow down the execution\n\t\treturn _convert_dc(THRESHOLD_CONVERT_DC >> 1, f, t, a, ai, aj, b, bi, bj);\n\t}\n\n\treturn _convert_to_larger_slow(f, t, a, ai, aj, b, bi, bj);\n}\n","import _copy from '../array/_copy.js';\nimport _convert_to_smaller from './_convert_to_smaller.js';\nimport _convert_to_larger from './_convert_to_larger.js';\n\n/**\n *\n * Dispatcher for the various base conversion implementations.\n * The decision is based on the relation f <= t.\n *\n * @param {number} f the base to convert from\n * @param {number} t the base to convert to\n * @param {number[]} a the origin array\n * @param {number} ai start offset in the origin array\n * @param {number} aj end offset in the origin array\n * @param {number[]} b the destination array\n * @param {number} bi start offset in the destination array\n * @param {number} bj end offset in the destination array\n */\n\nexport default function _convert(f, t, a, ai, aj, b, bi, bj) {\n\tif (f > t) return _convert_to_smaller(f, t, a, ai, aj, b, bi, bj);\n\tif (f < t) return _convert_to_larger(f, t, a, ai, aj, b, bi, bj);\n\treturn _copy(a, ai, aj, b, bi);\n}\n","import _zeros from '../array/_zeros.js';\nimport _convert from './_convert.js';\n\n/**\n * Converts the input number A represented in base f to a number B represented\n * in base t. All leading zeros resulting from the conversion are kept.\n *\n * @param {number} f the base to convert from\n * @param {number} t the base to convert to\n * @param {number[]} a the origin array\n * @param {number} ai start offset in the origin array\n * @param {number} aj end offset in the origin array\n *\n * @return {number[]} The resulting limb array.\n */\nexport default function convert_keep_zeros(f, t, a, ai, aj) {\n\tconst bi = 0;\n\tconst bj = Math.ceil((Math.log(f) / Math.log(t)) * (aj - ai));\n\tconst b = _zeros(bj - bi);\n\n\t_convert(f, t, a, ai, aj, b, bi, bj);\n\n\treturn b;\n}\n","import _alloc from '../array/_alloc.js';\nimport _copy from '../array/_copy.js';\nimport _trim_positive from './_trim_positive.js';\n\n/**\n * Trim a limb array so that it is either [0] or does not start with any\n * leading zeros. Return a newly allocated array and does not modify the input.\n *\n * @param {number[]} a The input limb array.\n * @param {number} ai\n * @param {number} aj\n *\n * @return {number[]} The input but trimmed.\n */\nexport default function trim_natural(a, ai, aj) {\n\tconst x = _trim_positive(a, ai, aj);\n\n\tif (x >= aj) return [0];\n\n\tconst b = _alloc(aj - x);\n\n\t_copy(a, x, aj, b, 0);\n\n\treturn b;\n}\n","import assert from 'assert';\nimport convert_keep_zeros from '../../core/convert/convert_keep_zeros.js';\nimport trim_natural from '../../core/convert/trim_natural.js';\n\n/**\n * Converts the input number A represented in base f to a number B represented\n * in base t. If A is 0 the output is B = [0], otherwise all leading zeros are\n * trimmed.\n *\n * @param {number} f the base to convert from\n * @param {number} t the base to convert to\n * @param {number[]} a the origin array\n * @param {number} ai start offset in the origin array\n * @param {number} aj end offset in the origin array\n *\n * @return {number[]} The result of the conversion.\n */\nexport default function convert(f, t, a, ai, aj) {\n\tassert(f >= 2);\n\tassert(t >= 2);\n\tassert(ai >= 0);\n\tassert(aj <= a.length);\n\tassert(aj - ai >= 0);\n\n\tconst b = convert_keep_zeros(f, t, a, ai, aj);\n\n\treturn trim_natural(b, 0, b.length);\n}\n","/**\n * Converts an input character representation to a limb.\n *\n * @param {string} x input character\n *\n * @return {number} output limb\n */\nexport default function _int(x) {\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tif (x >= '0' && x <= '9') return x.charCodeAt(0) - 48;\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tif (x >= 'A' && x <= 'Z') return x.charCodeAt(0) - 55;\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tif (x >= 'a' && x <= 'z') return x.charCodeAt(0) - 87;\n\n\tthrow new Error('invalid literal for _int: ' + x);\n}\n","import _int from './_int.js';\n\n/**\n * Converts a string representation to a limb array representation without\n * radix conversion.\n *\n * @param {string} string input string\n *\n * @return {number[]} output limb array\n */\nexport default function _from_string(string) {\n\tconst n = string.length;\n\n\tconst a = [];\n\n\tfor (let k = 0; k < n; ++k) a.push(_int(string[k]));\n\n\treturn a;\n}\n","import _from_string from './_from_string.js';\nimport convert_keep_zeros from './convert_keep_zeros.js';\n\n/**\n * Converts a string representation in base f to a limb array in base t keeping\n * all leading zeros resulting from the conversion process.\n *\n * @param {number} f radix of the representation\n * @param {number} t radix of the limb array\n * @param {string} string the input representation\n *\n * @return {number[]} the resulting limb array\n */\nexport default function parse_keep_zeros(f, t, string) {\n\tif (f > 36) throw new Error('f > 36 not implemented');\n\n\tconst a = _from_string(string);\n\n\treturn convert_keep_zeros(f, t, a, 0, a.length);\n}\n","import parse_keep_zeros from '../../core/convert/parse_keep_zeros.js';\nimport trim_natural from '../../core/convert/trim_natural.js';\n\n/**\n * Converts a string representation in base f to a limb array in base t.\n *\n * @param {number} f radix of the representation\n * @param {number} t radix of the limb array\n * @param {string} string the input representation\n *\n * @return {number[]} the resulting limb array\n */\nexport default function parse(f, t, string) {\n\tconst b = parse_keep_zeros(f, t, string);\n\n\treturn trim_natural(b, 0, b.length);\n}\n","import assert from 'assert';\n\n/**\n * Converts a limb to a character representation. This only works if the limb\n * is at most 35.\n *\n * @param {number} x The input limb.\n *\n * @return {string} The corresponding character representation.\n */\nexport default function _chr(x) {\n\tassert(x >= 0);\n\tassert(x < 36);\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tif (x < 10) return String.fromCharCode(48 + x);\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\treturn String.fromCharCode(87 + x);\n}\n","import _chr from './_chr.js';\n\n/**\n * Convert an entire limb array to a string representation (without changing\n * the radix).\n *\n * @param {number[]} b The inpurt limb array.\n *\n * @return {string} The string representation.\n */\nexport default function _to_string(b) {\n\tconst n = b.length;\n\n\tconst data = [];\n\n\tfor (let k = 0; k < n; ++k) data.push(_chr(b[k]));\n\n\treturn data.join('');\n}\n","import _to_string from '../../core/convert/_to_string.js';\nimport convert from './convert.js';\n\n/**\n * Converts a limb array in base f to a string representation in base t.\n *\n * @param {number} f radix of the limb array\n * @param {number} t radix of the representation\n * @param {number[]} a the input limb array\n * @param {number} ai left bound of the input\n * @param {number} aj non-inclusive right bound of the input\n *\n * @return {string} the resulting representation\n */\nexport default function stringify(f, t, a, ai, aj) {\n\tif (t > 36) throw new Error('t > 36 not implemented');\n\n\tconst b = convert(f, t, a, ai, aj);\n\n\treturn _to_string(b);\n}\n","import parse from './parse.js';\nimport stringify from './stringify.js';\n\n/**\n * Converts a string representation in base f to a string representation in\n * base t.\n *\n * @param {number} f radix of the input\n * @param {number} t radix of the output\n * @param {string} string the input representation\n *\n * @return {string} the output representation\n */\nexport default function translate(f, t, string) {\n\tconst a = parse(f, t, string);\n\treturn stringify(t, t, a, 0, a.length);\n}\n","import assert from 'assert';\n\n/**\n * Subtracts two big endian arrays, |C| >= |A| >= |B|.\n * Wraps.\n *\n * @param {Number} r base (radix)\n * @param {array} a first operand\n * @param {Number} ai a left\n * @param {Number} aj a right\n * @param {array} b second operand\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {array} c result, must be 0 initialized\n * @param {Number} ci c left\n * @param {Number} cj c right\n */\n\nexport default function _sub(r, a, ai, aj, b, bi, bj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(cj - ci >= aj - ai);\n\tassert(aj - ai >= bj - bi);\n\n\tlet T;\n\tlet C = 0;\n\n\twhile (--bj >= bi) {\n\t\t--aj;\n\t\t--cj;\n\t\tT = C;\n\t\tC = (a[aj] < b[bj] + T) | 0;\n\t\tc[cj] = a[aj] - b[bj] + (C * r - T);\n\t}\n\n\twhile (--aj >= ai) {\n\t\t--cj;\n\t\tT = C;\n\t\tC = (a[aj] < T) | 0;\n\t\tc[cj] = a[aj] + (C * r - T);\n\t}\n\n\tif (C) {\n\t\twhile (--cj >= ci) {\n\t\t\tc[cj] = r - 1;\n\t\t}\n\t}\n}\n","import assert from 'assert';\n\nimport _sub from '../sub/_sub.js';\nimport lt from '../../../api/compare/lt.js';\nimport jz from '../../../api/compare/jz.js';\n\n/**\n * Computes quotient and remainder of two big endian arrays.\n * <p>\n * Computes quotient and remainder of two big endian arrays\n * using long division algorithm (the one teached in\n * european primary schools).\n *\n * /!\\ This algorithm modifies its first operand.\n *\n * HYP : q is at least as large as r\n *       b is not zero\n *\n * @param {Number} x the radix\n * @param {array} r dividend and remainder\n * @param {Number} ri r left\n * @param {Number} rj r right\n * @param {array} b divisor\n * @param {Number} bi b left\n * @param {Number} bj b right\n * @param {array} q quotient, must be 0 initialized\n * @param {Number} qi q left\n */\n\n// /!\\ There are implicit hypotheses\n//     made on the size of the operands.\n//     Should clarify.\n\nexport default function _idivmod_slow(x, r, ri, rj, b, bi, bj, q, qi) {\n\tassert(x >= 2);\n\tassert(ri >= 0 && rj <= r.length);\n\tassert(bi >= 0 && bj <= b.length);\n\tassert(qi >= 0);\n\tassert(q.length - qi >= rj - ri);\n\tassert(!jz(b, bi, bj));\n\tassert(jz(q, qi, qi + rj - ri));\n\n\tlet k;\n\tconst t = ri + 1;\n\n\tdo {\n\t\t// Trim leading zeros\n\t\t// TODO maybe could try to put this procedure inside the _sub loop\n\t\t// TODO or assume that the number is trimed at the begining\n\t\t//      and put this statement at the end of the main loop\n\t\twhile (ri < rj && r[ri] === 0) ++ri;\n\n\t\t// Search for a remainder block interval\n\t\t// greater than the divisor\n\t\t// TODO maybe could try binary search on the lt function\n\t\t//      for another implementation\n\t\tk = ri + 1;\n\t\twhile (k <= rj && lt(r, ri, k, b, bi, bj)) ++k;\n\n\t\t// Remainder smaller than divisor --> end\n\t\tif (k > rj) break;\n\n\t\t// Divide current block interval by quotient\n\t\tdo {\n\t\t\t// Increment quotient block corresponding\n\t\t\t// to current ls block of remainder interval\n\t\t\t++q[qi + k - t];\n\n\t\t\t// Subtract divisor from current remainder\n\t\t\t// block interval\n\t\t\t_sub(x, r, ri, k, b, bi, bj, r, ri, k);\n\t\t} while (!lt(r, ri, k, b, bi, bj));\n\t} while (true);\n}\n","import _karatsuba from './_karatsuba.js';\n\nconst _toom22 = _karatsuba;\nexport default _toom22;\n","import assert from 'assert';\n\nimport jz from '../../../api/compare/jz.js';\nimport _zeros from '../../array/_zeros.js';\nimport _copy from '../../array/_copy.js';\nimport _mul from '../mul/_mul.js';\n\n/**\n * Computes <code>pow(a,x) = a^x</code> using exponentiation by squaring.\n * Writes result to output array.\n *\n * /!\\ |A| >= 1, |C| >= 1, |C| >= |A| * x, |C| = 000...0\n *\n * @param {Number} r The base to work with.\n * @param {Number} x The power to raise <code>a</code> to.\n * @param {Array} a The base array.\n * @param {Number} ai <code>a</code> left.\n * @param {Number} aj <code>b</code> right.\n * @param {Array} c The output array.\n * @param {Number} ci <code>a</code> left.\n * @param {Number} cj <code>b</code> right.\n */\nexport default function _pow_double_recursive(r, x, a, ai, aj, c, ci, cj) {\n\tassert(r >= 2);\n\tassert(x >= 0);\n\tassert(ai >= 0 && aj <= a.length);\n\tassert(ci >= 0 && cj <= c.length);\n\tassert(aj - ai >= 1);\n\tassert(cj - ci >= 1);\n\tassert(cj - ci >= (aj - ai) * x);\n\tassert(jz(c, ci, cj));\n\n\tif (x === 0) {\n\t\tc[cj - 1] = 1;\n\t} else if (x === 1) {\n\t\t_copy(a, ai, aj, c, cj - (aj - ai));\n\t} else if (x & 1) {\n\t\tconst p = x - 1;\n\t\tconst n = (aj - ai) * p;\n\t\tconst u = _zeros(n);\n\n\t\t_pow_double_recursive(r, p, a, ai, aj, u, 0, n);\n\t\t_mul(r, u, 0, n, a, ai, aj, c, ci, cj); // Largest must be put first\n\t} else {\n\t\tconst p = (x / 2) | 0;\n\t\tconst n = (aj - ai) * p;\n\t\tconst u = _zeros(n);\n\n\t\t_pow_double_recursive(r, p, a, ai, aj, u, 0, n);\n\t\t_mul(r, u, 0, n, u, 0, n, c, ci, cj); // TODO use squaring function here\n\t}\n}\n"],"names":["_copy","a","ai","aj","b","bi","_add","r","bj","c","ci","cj","C","t","add","k","Math","max","T","iadd","_iadd","_r","_idivmod_limb_with_prefix","tmp","d","D","Di","Dj","Q","Qi","_alloc","n","Array","_fill","v","i","_reset","_zeros","_mul_limb","x","jz","_trim_positive","_cmp_n","_cmp","cmp","_validate","base","_isub","_cmp_half_even_radix","_cmp_half","floor","_cmp_half_odd_radix","_idivmod_schoolbook_subroutine_do","q","qi","m","_q","min","gt","_idivmod_schoolbook_subroutine","increment","_idivmod_schoolbook_large_divisor","lt","_aj","ak","_div_limb_with_prefix","_idivmod_schoolbook","ceil","z","_a","_b","_imul_limb","_schoolbook_mul","j","_karatsuba_right_op_is_small","N_","_mul","i_","N","_karatsuba","I","t2","t3","z2","z0","j_","t1","_idivmod_dc_32","_idivmod_dc_21","zj","decrement","R","_idivmod_dc","X","s","_n","shift","_X","_normalize","_ak","_bj","_cj","_c","_mod_limb","_idivmod","di","dj","Qj","dn","_divmod","Ri","Rj","_imod_limb","_imod_schoolbook_subroutine_do","_imod_schoolbook_large_divisor","_imod_schoolbook_subroutine","_imod_schoolbook","_imod","_","_i","_j","_euclidean_algorithm_loop","euclidean_algorithm","_ai","_bi","R0","R1","_extended_euclidean_algorithm_allocate","S0","length","T0","S1","T1","mul","_extended_euclidean_algorithm_loop","R0i","R1i","R1j","S0i","S0j","T0i","T0j","S1i","S1j","T1i","T1j","Xi","Xj","R0j","steps","_extended_euclidean_algorithm","extended_euclidean_algorithm","_log","y","_convert_to_smaller_fast","br","w","_convert_to_smaller_slow","f","batch","_idivmod_limb","block","end","_build","number","data","_pow_double","xbits","push","_m","pop","_o","_iadd_limb","_convert_to_larger_slow","rounds","first","w1","_end","_convert_slow","_convert_dc","size_small_block","logratio","log","full_small_blocks","size_first_small_block","size_first_small_block_converted","_ti","size_memory","size_small_block_converted","tmp2","tmp1","xi","x2","_x","_xi","x1","sfbc","extra","_tk","_tj","sbc","_ti2","pairs","x3","tmp3","_convert_to_smaller","THRESHOLD_CONVERT_DC","_convert_to_larger_fast","ar","_convert_to_larger","_convert","trim_natural","convert_keep_zeros","_int","charCodeAt","Error","_from_string","string","parse_keep_zeros","parse","_chr","String","fromCharCode","_to_string","join","stringify","convert","translate","_sub","_idivmod_slow","ri","rj","_pow_double_recursive","p","u"],"mappings":"AAWwBA,SAAAA,EAAMC,EAAGC,EAAIC,EAAIC,EAAGC,GAK3C,KAAOH,EAAKC,IAAMD,IAAMG,EAAID,EAAEC,GAAMJ,EAAEC,EAEvC,CCCwBI,SAAAA,EAAKC,EAAGN,EAAGC,EAAIC,EAAIC,EAAGC,EAAIG,EAAIC,EAAGC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