@mark1russell7/interval 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +20 -20
- package/build/index.js.map +1 -1
- package/package.json +3 -3
package/build/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var interval_exports = /* @__PURE__ */ __exportAll({
|
|
|
21
21
|
sumError: () => sumError
|
|
22
22
|
});
|
|
23
23
|
/** The interval that contains every real. */
|
|
24
|
-
const WHOLE = [-
|
|
24
|
+
const WHOLE = [-1e400, 1e400];
|
|
25
25
|
const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
26
26
|
/**
|
|
27
27
|
* This function gives the next float above a value.
|
|
@@ -30,7 +30,7 @@ const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
|
30
30
|
* @returns The smallest float that is larger than `x`. `Infinity` stays `Infinity`, and `NaN` stays `NaN`.
|
|
31
31
|
*/
|
|
32
32
|
function nextUp(x) {
|
|
33
|
-
if (Number.isNaN(x) || x ===
|
|
33
|
+
if (Number.isNaN(x) || x === 1e400) return x;
|
|
34
34
|
if (x === 0) return Number.MIN_VALUE;
|
|
35
35
|
view.setFloat64(0, x);
|
|
36
36
|
const bits = view.getBigUint64(0);
|
|
@@ -59,7 +59,7 @@ function sumError(a, b, s) {
|
|
|
59
59
|
const bb = s - a;
|
|
60
60
|
return a - (s - bb) + (b - bb);
|
|
61
61
|
}
|
|
62
|
-
const SPLIT =
|
|
62
|
+
const SPLIT = 0x8000001;
|
|
63
63
|
/**
|
|
64
64
|
* This function gives the exact error of a float product. It uses the error term of `TwoProduct` (Dekker). Near
|
|
65
65
|
* overflow or underflow the term is not reliable, so the function then gives `NaN`.
|
|
@@ -138,8 +138,8 @@ function boundProduct(a, b) {
|
|
|
138
138
|
*/
|
|
139
139
|
function mul$1(x, y) {
|
|
140
140
|
if (x === null || y === null) return null;
|
|
141
|
-
let lo =
|
|
142
|
-
let hi = -
|
|
141
|
+
let lo = 1e400;
|
|
142
|
+
let hi = -1e400;
|
|
143
143
|
for (const a of x) for (const b of y) {
|
|
144
144
|
const p = boundProduct(a, b);
|
|
145
145
|
const e = productError(a, b, p);
|
|
@@ -173,15 +173,15 @@ function div$1(x, y) {
|
|
|
173
173
|
if (x === null || y === null) return null;
|
|
174
174
|
if (y[0] === 0 && y[1] === 0) return null;
|
|
175
175
|
if (y[0] <= 0 && y[1] >= 0) return WHOLE;
|
|
176
|
-
let lo =
|
|
177
|
-
let hi = -
|
|
176
|
+
let lo = 1e400;
|
|
177
|
+
let hi = -1e400;
|
|
178
178
|
for (const a of x) for (const b of y) if (Number.isFinite(a) && Number.isFinite(b)) {
|
|
179
179
|
const q = a / b;
|
|
180
180
|
const exact = quotientIsExact(a, b, q);
|
|
181
181
|
lo = Math.min(lo, exact ? q : nextDown(q));
|
|
182
182
|
hi = Math.max(hi, exact ? q : nextUp(q));
|
|
183
183
|
} else {
|
|
184
|
-
const q = Number.isFinite(b) ? a / b : Number.isFinite(a) ? 0 : a > 0 === b > 0 ?
|
|
184
|
+
const q = Number.isFinite(b) ? a / b : Number.isFinite(a) ? 0 : a > 0 === b > 0 ? 1e400 : -1e400;
|
|
185
185
|
lo = Math.min(lo, q);
|
|
186
186
|
hi = Math.max(hi, q);
|
|
187
187
|
}
|
|
@@ -243,16 +243,16 @@ const STEPS = 64;
|
|
|
243
243
|
*/
|
|
244
244
|
function rootUp(m, k) {
|
|
245
245
|
let z = rootOf(m, k);
|
|
246
|
-
for (let i = 0; z <
|
|
246
|
+
for (let i = 0; z < 1e400 && i < STEPS; i++) {
|
|
247
247
|
if (powLow(z, k) >= m) return z;
|
|
248
248
|
z = i < 8 ? nextUp(z) : z * (1 + 2 ** (i - 60));
|
|
249
249
|
}
|
|
250
|
-
return
|
|
250
|
+
return 1e400;
|
|
251
251
|
}
|
|
252
252
|
/** This function gives a float `z >= 0` with `z^k <= m`, for `m >= 0`. After `STEPS` steps it gives `0`. */
|
|
253
253
|
function rootDown(m, k) {
|
|
254
254
|
let z = rootOf(m, k);
|
|
255
|
-
if (m ===
|
|
255
|
+
if (m === 1e400) return z;
|
|
256
256
|
for (let i = 0; z > 0 && i < STEPS; i++) {
|
|
257
257
|
if (powHigh(z, k) <= m) return z;
|
|
258
258
|
z = i < 8 ? nextDown(z) : z * (1 - 2 ** (i - 60));
|
|
@@ -473,7 +473,7 @@ const MIN = Number.MIN_VALUE;
|
|
|
473
473
|
/** The ball that makes no claim. */
|
|
474
474
|
const NO_CLAIM = {
|
|
475
475
|
mid: NaN,
|
|
476
|
-
rad:
|
|
476
|
+
rad: 1e400
|
|
477
477
|
};
|
|
478
478
|
/**
|
|
479
479
|
* This function gives a bound of the error `|e|` of the rounding of a float result `m`. An exact error term `e`
|
|
@@ -494,7 +494,7 @@ function roundingBound(e, m) {
|
|
|
494
494
|
* @returns `r`, or `Infinity` when `m` is not finite or `r` is `NaN`.
|
|
495
495
|
*/
|
|
496
496
|
function claim(m, r) {
|
|
497
|
-
return m - m === 0 && r <=
|
|
497
|
+
return m - m === 0 && r <= 1e400 ? r : 1e400;
|
|
498
498
|
}
|
|
499
499
|
/**
|
|
500
500
|
* This function makes a ball. A midpoint that is not finite gives the radius `Infinity`.
|
|
@@ -518,7 +518,7 @@ function ball(mid, rad = 0) {
|
|
|
518
518
|
* @returns An interval that contains each point of the ball. A ball that makes no claim gives the whole line.
|
|
519
519
|
*/
|
|
520
520
|
function toInterval(x) {
|
|
521
|
-
if (!(x.rad <
|
|
521
|
+
if (!(x.rad < 1e400)) return WHOLE;
|
|
522
522
|
return add$1([x.mid, x.mid], [-x.rad, x.rad]);
|
|
523
523
|
}
|
|
524
524
|
/**
|
|
@@ -577,7 +577,7 @@ function productRadius(m, a, ra, b, rb) {
|
|
|
577
577
|
*/
|
|
578
578
|
function quotientRadius(q, a, ra, b, rb) {
|
|
579
579
|
const m = Math.abs(b);
|
|
580
|
-
if (!(rb < m) || !(q - q === 0)) return
|
|
580
|
+
if (!(rb < m) || !(q - q === 0)) return 1e400;
|
|
581
581
|
return claim(q, addUp(divUp(addUp(ra, mulUp(q === 0 ? 0 : nextUp(Math.abs(q)), rb)), subDown(m, rb)), quotientIsExact(a, b, q) ? 0 : addUp(mulUp(U, Math.abs(q)), MIN)));
|
|
582
582
|
}
|
|
583
583
|
/**
|
|
@@ -610,11 +610,11 @@ function extremeRadius(sign, a, ra, b, rb) {
|
|
|
610
610
|
* @returns The radius of the root, or `Infinity` when an even root can meet a negative value.
|
|
611
611
|
*/
|
|
612
612
|
function rootRadius(v, r, rr, k) {
|
|
613
|
-
if (!(rr <
|
|
613
|
+
if (!(rr < 1e400) || !(v - v === 0)) return 1e400;
|
|
614
614
|
const span = add$1([r, r], [-rr, rr]);
|
|
615
|
-
if (span === null || k % 2 === 0 && span[0] < 0) return
|
|
615
|
+
if (span === null || k % 2 === 0 && span[0] < 0) return 1e400;
|
|
616
616
|
const d = sub$1([v, v], root$1(span, k));
|
|
617
|
-
return d === null ?
|
|
617
|
+
return d === null ? 1e400 : claim(v, Math.max(-d[0], d[1]));
|
|
618
618
|
}
|
|
619
619
|
/**
|
|
620
620
|
* This function gives the sum of two balls.
|
|
@@ -728,7 +728,7 @@ function pow(x, n) {
|
|
|
728
728
|
let br = x.rad;
|
|
729
729
|
if (n === 0) return {
|
|
730
730
|
mid: 1,
|
|
731
|
-
rad: br <
|
|
731
|
+
rad: br < 1e400 ? 0 : 1e400
|
|
732
732
|
};
|
|
733
733
|
let rv = 1;
|
|
734
734
|
let rr = 0;
|
|
@@ -779,7 +779,7 @@ function root(x, k) {
|
|
|
779
779
|
}
|
|
780
780
|
/** This function decides a comparison of two balls with the outward intervals of the balls. */
|
|
781
781
|
function comparison(kind, x, y) {
|
|
782
|
-
if (!(x.rad <
|
|
782
|
+
if (!(x.rad < 1e400 && y.rad < 1e400)) return NO_CLAIM;
|
|
783
783
|
const truth = interval_exports[kind](toInterval(x), toInterval(y));
|
|
784
784
|
if (truth[0] === truth[1]) return {
|
|
785
785
|
mid: truth[0],
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["add","neg","sub","mul","div","pow","root","min","max","lt","le","eq","I.WHOLE","I.add","I.sub","I.sumError","I.productError","I.nextUp","I.quotientIsExact","I.root","I"],"sources":["../src/interval.ts","../src/rounding.ts","../src/ball.ts"],"sourcesContent":["/**\n * Intervals of real numbers with float bounds. Each operation rounds outward, so the exact result of the operation on\n * any reals inside the inputs is inside the output. An infinite bound means that the interval has no bound on that side.\n *\n * `null` is the empty interval: no point of the inputs gives a real value.\n *\n * @packageDocumentation\n */\n\n/** A closed interval `[low, high]` of reals, or `null` for the empty interval. */\nexport type Interval = readonly [number, number] | null;\n\n/** The interval that contains every real. */\nexport const WHOLE: readonly [number, number] = [-Infinity, Infinity];\n\nconst view = new DataView(new ArrayBuffer(8));\n\n/**\n * This function gives the next float above a value.\n *\n * @param x - The value.\n * @returns The smallest float that is larger than `x`. `Infinity` stays `Infinity`, and `NaN` stays `NaN`.\n */\nexport function nextUp(x: number): number {\n if (Number.isNaN(x) || x === Infinity) return x;\n if (x === 0) return Number.MIN_VALUE;\n view.setFloat64(0, x);\n const bits = view.getBigUint64(0);\n view.setBigUint64(0, x > 0 ? bits + 1n : bits - 1n);\n return view.getFloat64(0);\n}\n\n/**\n * This function gives the next float below a value.\n *\n * @param x - The value.\n * @returns The largest float that is smaller than `x`. `-Infinity` stays `-Infinity`, and `NaN` stays `NaN`.\n */\nexport function nextDown(x: number): number {\n return -nextUp(-x);\n}\n\n/**\n * This function gives the exact error of a float sum. It uses the error term of `TwoSum` (Knuth).\n *\n * @param a - The first value.\n * @param b - The second value.\n * @param s - The float sum `a + b`.\n * @returns The float `e` with `a + b = s + e` exactly, or `NaN` when `s` is not finite and the term is not reliable.\n */\nexport function sumError(a: number, b: number, s: number): number {\n if (!Number.isFinite(s)) return Number.NaN;\n const bb = s - a;\n return a - (s - bb) + (b - bb);\n}\n\nconst SPLIT = 134217729; // 2^27 + 1, the constant of the split of Veltkamp.\n\n/**\n * This function gives the exact error of a float product. It uses the error term of `TwoProduct` (Dekker). Near\n * overflow or underflow the term is not reliable, so the function then gives `NaN`.\n *\n * @param a - The first value.\n * @param b - The second value.\n * @param p - The float product `a * b`.\n * @returns The float `e` with `a * b = p + e` exactly, or `NaN` when the term is not reliable.\n */\nexport function productError(a: number, b: number, p: number): number {\n if (a === 0 || b === 0) return 0;\n const m = Math.abs(p);\n if (!(m > 2 ** -900 && m < 2 ** 990) || Math.abs(a) > 2 ** 990 || Math.abs(b) > 2 ** 990) return Number.NaN;\n const ca = SPLIT * a;\n const ah = ca - (ca - a);\n const al = a - ah;\n const cb = SPLIT * b;\n const bh = cb - (cb - b);\n const bl = b - bh;\n return al * bl - (p - ah * bh - al * bh - ah * bl);\n}\n\n/**\n * This function gives a lower bound of `v + e` for a float `v` and its exact error `e`. An exact `v` is the bound.\n * Else the bound is one float lower. Round to nearest puts `v + e` within half a step of `v`, so one step is enough.\n * An error of `NaN` is not known, and it gives the step. The sign of `e` is not used, so that each bound of A1 stays\n * the same.\n */\nconst below = (v: number, e: number): number => (e === 0 ? v : nextDown(v));\n\n/** This function gives an upper bound of `v + e`, with the rule of `below`. */\nconst above = (v: number, e: number): number => (e === 0 ? v : nextUp(v));\n\n/**\n * This function gives the sum of two intervals, rounded outward.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns An interval that contains each sum of a point of `x` and a point of `y`.\n */\nexport function add(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n const lo = x[0] + y[0];\n const hi = x[1] + y[1];\n return [below(lo, sumError(x[0], y[0], lo)), above(hi, sumError(x[1], y[1], hi))];\n}\n\n/**\n * This function gives the negation of an interval. It is exact.\n *\n * @param x - The interval.\n * @returns The interval of the negated points.\n */\nexport function neg(x: Interval): Interval {\n return x === null ? null : [-x[1], -x[0]];\n}\n\n/**\n * This function gives the difference of two intervals, rounded outward.\n *\n * @param x - The first interval.\n * @param y - The interval to subtract.\n * @returns An interval that contains each difference of a point of `x` and a point of `y`.\n */\nexport function sub(x: Interval, y: Interval): Interval {\n return add(x, neg(y));\n}\n\n/**\n * This function gives one float product for an interval bound. A zero times an infinite bound is zero, because the\n * infinite bound stands for large reals, not for infinity.\n */\nfunction boundProduct(a: number, b: number): number {\n return a === 0 || b === 0 ? 0 : a * b;\n}\n\n/**\n * This function gives the product of two intervals, rounded outward.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns An interval that contains each product of a point of `x` and a point of `y`.\n */\nexport function mul(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n let lo = Infinity;\n let hi = -Infinity;\n for (const a of x) {\n for (const b of y) {\n const p = boundProduct(a, b);\n const e = productError(a, b, p);\n lo = Math.min(lo, below(p, e));\n hi = Math.max(hi, above(p, e));\n }\n }\n return [lo, hi];\n}\n\n/**\n * This function tells if a float quotient is exact: the product `q * b` is exact and is `a`.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @param q - The float quotient `a / b`.\n * @returns `true` when `q` is the exact quotient.\n */\nexport function quotientIsExact(a: number, b: number, q: number): boolean {\n const p = q * b;\n return p === a && productError(q, b, p) === 0;\n}\n\n/**\n * This function gives the quotient of two intervals, rounded outward. A divisor interval that contains zero gives the\n * whole line, and the point zero gives the empty interval. A quotient of two finite bounds moves one step outward on\n * each side when it is not exact. A quotient with an infinite bound is `0` or infinite, and it is a bound as it is.\n *\n * @param x - The dividend.\n * @param y - The divisor.\n * @returns An interval that contains each quotient of a point of `x` and a nonzero point of `y`.\n */\nexport function div(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (y[0] === 0 && y[1] === 0) return null;\n if (y[0] <= 0 && y[1] >= 0) return WHOLE;\n let lo = Infinity;\n let hi = -Infinity;\n for (const a of x) {\n for (const b of y) {\n if (Number.isFinite(a) && Number.isFinite(b)) {\n const q = a / b;\n const exact = quotientIsExact(a, b, q);\n lo = Math.min(lo, exact ? q : nextDown(q));\n hi = Math.max(hi, exact ? q : nextUp(q));\n } else {\n const q = Number.isFinite(b) ? a / b : Number.isFinite(a) ? 0 : (a > 0) === (b > 0) ? Infinity : -Infinity;\n lo = Math.min(lo, q);\n hi = Math.max(hi, q);\n }\n }\n }\n return [lo, hi];\n}\n\n/**\n * This function gives the square of an interval, rounded outward. It is tighter than `mul(x, x)` for an interval\n * that contains zero.\n */\nfunction square(x: readonly [number, number]): Interval {\n const [a, b] = x;\n if (a >= 0) return mul(x, x);\n if (b <= 0) return mul(neg(x), neg(x));\n const m = Math.max(-a, b);\n const top = mul([m, m], [m, m]);\n return top === null ? null : [0, top[1]];\n}\n\n/**\n * This function gives an interval to a whole power, rounded outward. The power zero gives the point one, also for a\n * base of zero. A negative power is the reciprocal of the positive power.\n *\n * @param x - The base.\n * @param n - The exponent. It must be a whole number.\n * @returns An interval that contains each power of a point of `x`.\n */\nexport function pow(x: Interval, n: number): Interval {\n if (x === null) return null;\n if (!Number.isInteger(n)) throw new RangeError(`pow needs a whole exponent, not ${n}.`);\n if (n < 0) return div([1, 1], pow(x, -n));\n let result: Interval = [1, 1];\n let base: Interval = x;\n for (let k = n; k > 0; k = Math.floor(k / 2)) {\n if (k % 2 === 1) result = mul(result, base);\n if (k > 1 && base !== null) base = square(base);\n }\n return result;\n}\n\n/** This function tells if `r * r` is exactly `a`. */\nfunction isSquareOf(r: number, a: number): boolean {\n const p = r * r;\n return p === a && productError(r, r, p) === 0;\n}\n\n/** This function gives the smallest power of the interval `[z, z]`, rounded downward. */\nfunction powLow(z: number, k: number): number {\n const p = pow([z, z], k);\n return p === null ? Number.NaN : p[0];\n}\n\n/** This function gives the largest power of the interval `[z, z]`, rounded upward. */\nfunction powHigh(z: number, k: number): number {\n const p = pow([z, z], k);\n return p === null ? Number.NaN : p[1];\n}\n\nconst rootOf = (m: number, k: number): number => (k === 3 ? Math.cbrt(m) : Math.pow(m, 1 / k));\n\n/** The most steps of the search of `rootUp` and `rootDown`. After them, each function gives its trivial bound. */\nconst STEPS = 64;\n\n/**\n * This function gives a float `z >= 0` with `z^k >= m`, for `m >= 0`. The check uses the outward powers of `pow`.\n * Near overflow the check cannot pass, and the function gives `Infinity`.\n */\nfunction rootUp(m: number, k: number): number {\n let z = rootOf(m, k);\n for (let i = 0; z < Infinity && i < STEPS; i++) {\n if (powLow(z, k) >= m) return z;\n z = i < 8 ? nextUp(z) : z * (1 + 2 ** (i - 60));\n }\n return Infinity;\n}\n\n/** This function gives a float `z >= 0` with `z^k <= m`, for `m >= 0`. After `STEPS` steps it gives `0`. */\nfunction rootDown(m: number, k: number): number {\n let z = rootOf(m, k);\n if (m === Infinity) return z;\n for (let i = 0; z > 0 && i < STEPS; i++) {\n if (powHigh(z, k) <= m) return z;\n z = i < 8 ? nextDown(z) : z * (1 - 2 ** (i - 60));\n }\n return 0;\n}\n\n/**\n * This function gives the root of an interval, rounded outward. The square root uses `Math.sqrt`, which is correctly\n * rounded, and one step on each bound. A larger index starts from `Math.pow` and moves each bound until the outward\n * power of `pow` shows the side of the bound. The root is monotone, so the bounds of the ends are the bounds. An odd\n * index takes negative points as `-root(-x)`. An even index ignores negative points.\n *\n * @param x - The radicand.\n * @param k - The index of the root. It must be a whole number of 2 or more.\n * @returns An interval that contains the real root of each point of `x` that has one.\n */\nexport function root(x: Interval, k: number): Interval {\n if (x === null) return null;\n if (!Number.isInteger(k) || k < 2) throw new RangeError(`root needs a whole index of 2 or more, not ${k}.`);\n let [a, b] = x;\n if (k % 2 === 0) {\n if (b < 0) return null;\n a = Math.max(a, 0);\n }\n if (k === 2) {\n const lo = Math.sqrt(a);\n const hi = Math.sqrt(b);\n return [isSquareOf(lo, a) ? lo : Math.max(0, nextDown(lo)), isSquareOf(hi, b) ? hi : nextUp(hi)];\n }\n return [a < 0 ? -rootUp(-a, k) : rootDown(a, k), b < 0 ? -rootDown(-b, k) : rootUp(b, k)];\n}\n\n/**\n * This function gives the interval of the smallest of the points. It is exact.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns The interval of `min(p, q)` for `p` in `x` and `q` in `y`.\n */\nexport function min(x: Interval, y: Interval): Interval {\n return x === null || y === null ? null : [Math.min(x[0], y[0]), Math.min(x[1], y[1])];\n}\n\n/**\n * This function gives the interval of the largest of the points. It is exact.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns The interval of `max(p, q)` for `p` in `x` and `q` in `y`.\n */\nexport function max(x: Interval, y: Interval): Interval {\n return x === null || y === null ? null : [Math.max(x[0], y[0]), Math.max(x[1], y[1])];\n}\n\n/** The interval of a truth value: `1` is true and `0` is false. */\nconst TRUE: Interval = [1, 1];\nconst FALSE: Interval = [0, 0];\nconst UNKNOWN: Interval = [0, 1];\n\n/**\n * This function compares two intervals with `<`. The result is the interval of the truth value, with `1` for true.\n *\n * @param x - The left side.\n * @param y - The right side.\n * @returns `[1, 1]` when `p < q` for each pair of points, `[0, 0]` when for none, and `[0, 1]` when it is not known.\n */\nexport function lt(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (x[1] < y[0]) return TRUE;\n if (x[0] >= y[1]) return FALSE;\n return UNKNOWN;\n}\n\n/**\n * This function compares two intervals with `<=`. The result is the interval of the truth value, with `1` for true.\n *\n * @param x - The left side.\n * @param y - The right side.\n * @returns `[1, 1]` when `p <= q` for each pair of points, `[0, 0]` when for none, and `[0, 1]` when it is not known.\n */\nexport function le(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (x[1] <= y[0]) return TRUE;\n if (x[0] > y[1]) return FALSE;\n return UNKNOWN;\n}\n\n/**\n * This function compares two intervals with `=`. The result is the interval of the truth value, with `1` for true.\n *\n * @param x - The left side.\n * @param y - The right side.\n * @returns `[1, 1]` when both are the same point, `[0, 0]` when they do not meet, and `[0, 1]` when it is not known.\n */\nexport function eq(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (x[0] === x[1] && y[0] === y[1] && x[0] === y[0]) return TRUE;\n if (x[1] < y[0] || y[1] < x[0]) return FALSE;\n return UNKNOWN;\n}\n","/**\n * Directed rounding of nonnegative floats, from the exact error terms of `interval.ts`. Each function gives the\n * correctly rounded result when it is exact, and else the result one float step in the stated direction.\n *\n * @packageDocumentation\n */\nimport { nextDown, nextUp, productError, quotientIsExact, sumError } from \"./interval.ts\";\n\n/**\n * This function gives the sum of two nonnegative floats, rounded upward.\n *\n * @param x - The first value, 0 or more.\n * @param y - The second value, 0 or more.\n * @returns A float that is at least `x + y`, and at most one step above it.\n */\nexport function addUp(x: number, y: number): number {\n const s = x + y;\n return sumError(x, y, s) <= 0 ? s : nextUp(s);\n}\n\n/**\n * This function gives the product of two nonnegative floats, rounded upward.\n *\n * @param x - The first value, 0 or more.\n * @param y - The second value, 0 or more.\n * @returns A float that is at least `x * y`, and at most one step above it.\n */\nexport function mulUp(x: number, y: number): number {\n const p = x * y;\n return productError(x, y, p) <= 0 ? p : nextUp(p);\n}\n\n/**\n * This function gives the quotient of two nonnegative floats, rounded upward. A correctly rounded quotient is at most\n * one step low.\n *\n * @param x - The dividend, 0 or more.\n * @param y - The divisor, above 0.\n * @returns A float that is at least `x / y`, and at most one step above it.\n */\nexport function divUp(x: number, y: number): number {\n const q = x / y;\n return x === 0 || quotientIsExact(x, y, q) ? q : nextUp(q);\n}\n\n/**\n * This function gives the difference `x - y` of two nonnegative floats, rounded downward.\n *\n * @param x - The first value, 0 or more.\n * @param y - The value to subtract, 0 or more.\n * @returns A float that is at most `x - y`, and at most one step below it.\n */\nexport function subDown(x: number, y: number): number {\n const s = x - y;\n return sumError(x, -y, s) >= 0 ? s : nextDown(s);\n}\n\n/**\n * This function gives the float root of index `k`. The square root is correctly rounded. A larger index uses\n * `Math.cbrt` or `Math.pow`, which are not correctly rounded. An odd root of a negative value is negative.\n *\n * @param r - The radicand.\n * @param k - The index of the root, 2 or more.\n * @returns The float root.\n */\nexport function floatRoot(r: number, k: number): number {\n if (k === 2) return Math.sqrt(r);\n const f = (m: number): number => (k === 3 ? Math.cbrt(m) : Math.pow(m, 1 / k));\n return k % 2 === 1 && r < 0 ? -f(-r) : f(r);\n}\n","/**\n * Balls of real numbers: a float midpoint and a float radius, with the \"midrad\" arithmetic of Rump and of Arb. Each\n * function is a plain function of `{ mid, rad }` values. The midpoint of a result is the float result of the same\n * operation on the midpoints. The radius is the propagated radius of the parts plus the error of the rounding of the\n * midpoint. Each operation of the radius rounds upward.\n *\n * A finite radius is a claim. The exact result of the operation on each point of the input balls is at most the\n * radius from the midpoint. A radius of `Infinity` makes no claim. The radius rounds upward by one float step only\n * when its float operation is not exact, so an exact result has the radius zero.\n *\n * Proof sketch of the bound. Let the exact inputs of an operation be `X = a + dx` and `Y = b + dy`, with `|dx| <= ra`\n * and `|dy| <= rb`. Let `m` be the float result and `e` the error of its rounding.\n *\n * - A sum: `X + Y - m = e + dx + dy`, so `ra + rb + |e|` is a radius. `TwoSum` gives `e` exactly.\n * - A product: `XY - m = e + a dy + b dx + dx dy`, so `|a| rb + |b| ra + ra rb + |e|` is a radius. `TwoProduct`\n * gives `e` exactly away from overflow and underflow. Else `u |m| + 2^-1074` bounds `|e|`.\n * - A quotient, with `rb < |b|` so that `Y` is not zero: `X / Y - a / b = (b dx - a dy) / (b Y)`, and\n * `|b Y| >= |b| (|b| - rb)`. So `(ra + |a / b| rb) / (|b| - rb) + |e|` is a radius. Else the radius is `Infinity`.\n * - The smallest and the largest move at most by the largest radius of a part. `min` and `max` are 1-Lipschitz in\n * the largest distance. When the two balls do not meet, the extreme is one of them, so its radius is enough.\n * - A root goes through `interval.root` of `[m - r, m + r]`, rounded outward. The radius is the largest distance from\n * the midpoint to an end. An even root of a ball that holds a negative value has the radius `Infinity`.\n * - A comparison is decided when the outward intervals of the two balls decide it. The midpoint is then the truth\n * value and the radius is zero. Else the radius is one.\n *\n * The radius functions (`sumRadius`, `productRadius`, `quotientRadius`, `extremeRadius` and `rootRadius`) make no\n * object. An evaluator that keeps the midpoint and the radius in two numbers uses them.\n *\n * @packageDocumentation\n */\nimport * as I from \"./interval.ts\";\nimport type { Interval } from \"./interval.ts\";\nimport { addUp, divUp, floatRoot, mulUp, subDown } from \"./rounding.ts\";\n\n/** A ball: the reals at most `rad` from `mid`. */\nexport interface Ball {\n /** The midpoint. */\n readonly mid: number;\n /** The radius. `Infinity` makes no claim. */\n readonly rad: number;\n}\n\nconst U = 2 ** -53;\nconst MIN = Number.MIN_VALUE;\n\n/** The ball that makes no claim. */\nexport const NO_CLAIM: Ball = { mid: Number.NaN, rad: Infinity };\n\n/**\n * This function gives a bound of the error `|e|` of the rounding of a float result `m`. An exact error term `e`\n * gives `|e|`. An error term of `NaN` is not known, and it gives `u |m| + 2^-1074`, rounded upward.\n *\n * @param e - The exact error term, or `NaN`.\n * @param m - The float result.\n * @returns A bound of the error, rounded upward.\n */\nexport function roundingBound(e: number, m: number): number {\n return e === e ? Math.abs(e) : addUp(mulUp(U, Math.abs(m)), MIN);\n}\n\n/**\n * This function keeps a radius as a claim only when the midpoint is finite and the radius is a number.\n *\n * @param m - The midpoint.\n * @param r - The radius.\n * @returns `r`, or `Infinity` when `m` is not finite or `r` is `NaN`.\n */\nexport function claim(m: number, r: number): number {\n return m - m === 0 && r <= Infinity ? r : Infinity;\n}\n\n/**\n * This function makes a ball. A midpoint that is not finite gives the radius `Infinity`.\n *\n * @param mid - The midpoint.\n * @param rad - The radius, 0 or more. The default is 0.\n * @returns The ball.\n * @throws RangeError when the radius is negative or `NaN`.\n */\nexport function ball(mid: number, rad = 0): Ball {\n if (!(rad >= 0)) throw new RangeError(`The radius of a ball must be 0 or more, not ${rad}.`);\n return { mid, rad: claim(mid, rad) };\n}\n\n/**\n * This function gives the interval `[mid - rad, mid + rad]` of a ball, rounded outward.\n *\n * @param x - The ball.\n * @returns An interval that contains each point of the ball. A ball that makes no claim gives the whole line.\n */\nexport function toInterval(x: Ball): Interval {\n if (!(x.rad < Infinity)) return I.WHOLE;\n return I.add([x.mid, x.mid], [-x.rad, x.rad]);\n}\n\n/**\n * This function gives a ball that contains an interval. The midpoint is the float midpoint of the ends, and the\n * radius is the larger distance to an end, rounded upward.\n *\n * @param x - The interval.\n * @returns A ball that contains each point of `x`. The empty interval and an infinite end give `NO_CLAIM`.\n */\nexport function fromInterval(x: Interval): Ball {\n if (x === null || !(x[0] - x[0] === 0 && x[1] - x[1] === 0)) return NO_CLAIM;\n const [lo, hi] = x;\n const mid = lo / 2 + hi / 2;\n const d = I.sub([hi, hi], [mid, mid]) as readonly [number, number];\n const e = I.sub([mid, mid], [lo, lo]) as readonly [number, number];\n return { mid, rad: claim(mid, Math.max(d[1], e[1], 0)) };\n}\n\n/**\n * This function gives the radius of a sum `m = fl(a + b)`.\n *\n * @param m - The float sum of the midpoints.\n * @param a - The first midpoint.\n * @param ra - The first radius.\n * @param b - The second midpoint.\n * @param rb - The second radius.\n * @returns The radius of the sum, rounded upward.\n */\nexport function sumRadius(m: number, a: number, ra: number, b: number, rb: number): number {\n return claim(m, addUp(addUp(ra, rb), roundingBound(I.sumError(a, b, m), m)));\n}\n\n/**\n * This function gives the radius of a product `m = fl(a * b)`.\n *\n * @param m - The float product of the midpoints.\n * @param a - The first midpoint.\n * @param ra - The first radius.\n * @param b - The second midpoint.\n * @param rb - The second radius.\n * @returns The radius of the product, rounded upward.\n */\nexport function productRadius(m: number, a: number, ra: number, b: number, rb: number): number {\n const spread = addUp(addUp(mulUp(Math.abs(a), rb), mulUp(Math.abs(b), ra)), mulUp(ra, rb));\n return claim(m, addUp(spread, roundingBound(I.productError(a, b, m), m)));\n}\n\n/**\n * This function gives the radius of a quotient `q = fl(a / b)`.\n *\n * @param q - The float quotient of the midpoints.\n * @param a - The midpoint of the dividend.\n * @param ra - The radius of the dividend.\n * @param b - The midpoint of the divisor.\n * @param rb - The radius of the divisor.\n * @returns The radius of the quotient, rounded upward, or `Infinity` when the ball of the divisor can hold zero.\n */\nexport function quotientRadius(q: number, a: number, ra: number, b: number, rb: number): number {\n const m = Math.abs(b);\n if (!(rb < m) || !(q - q === 0)) return Infinity;\n const ratio = q === 0 ? 0 : I.nextUp(Math.abs(q));\n const spread = divUp(addUp(ra, mulUp(ratio, rb)), subDown(m, rb));\n const e = I.quotientIsExact(a, b, q) ? 0 : addUp(mulUp(U, Math.abs(q)), MIN);\n return claim(q, addUp(spread, e));\n}\n\n/**\n * This function gives the radius of the largest (`sign = 1`) or the smallest (`sign = -1`) of two balls. When the\n * outward intervals of the balls do not meet, the extreme is one ball, and its radius is the radius. Else the radius\n * is the larger radius.\n *\n * @param sign - `1` for the largest, `-1` for the smallest.\n * @param a - The first midpoint.\n * @param ra - The first radius.\n * @param b - The second midpoint.\n * @param rb - The second radius.\n * @returns The radius of the extreme. Give it to `claim` with the midpoint of the extreme.\n */\nexport function extremeRadius(sign: 1 | -1, a: number, ra: number, b: number, rb: number): number {\n const sa = I.add([sign * a, sign * a], [-ra, ra]) as readonly [number, number];\n const sb = I.add([sign * b, sign * b], [-rb, rb]) as readonly [number, number];\n if (sa[0] >= sb[1]) return ra;\n if (sb[0] >= sa[1]) return rb;\n return Math.max(ra, rb);\n}\n\n/**\n * This function gives the radius of a root `v = floatRoot(r, k)`. The radius is the largest distance from `v` to an\n * end of `interval.root` of the ball of the radicand, rounded upward.\n *\n * @param v - The float root of the midpoint.\n * @param r - The midpoint of the radicand.\n * @param rr - The radius of the radicand.\n * @param k - The index of the root, a whole number of 2 or more.\n * @returns The radius of the root, or `Infinity` when an even root can meet a negative value.\n */\nexport function rootRadius(v: number, r: number, rr: number, k: number): number {\n if (!(rr < Infinity) || !(v - v === 0)) return Infinity;\n const span = I.add([r, r], [-rr, rr]);\n if (span === null || (k % 2 === 0 && span[0] < 0)) return Infinity;\n const d = I.sub([v, v], I.root(span, k));\n return d === null ? Infinity : claim(v, Math.max(-d[0], d[1]));\n}\n\n/**\n * This function gives the sum of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains each sum of a point of `x` and a point of `y`.\n */\nexport function add(x: Ball, y: Ball): Ball {\n const m = x.mid + y.mid;\n return { mid: m, rad: sumRadius(m, x.mid, x.rad, y.mid, y.rad) };\n}\n\n/**\n * This function gives the difference of two balls.\n *\n * @param x - The first ball.\n * @param y - The ball to subtract.\n * @returns A ball that contains each difference of a point of `x` and a point of `y`.\n */\nexport function sub(x: Ball, y: Ball): Ball {\n const m = x.mid - y.mid;\n return { mid: m, rad: sumRadius(m, x.mid, x.rad, -y.mid, y.rad) };\n}\n\n/**\n * This function gives the negative of a ball. It is exact.\n *\n * @param x - The ball.\n * @returns The ball of the negative points.\n */\nexport function neg(x: Ball): Ball {\n return { mid: -x.mid, rad: x.rad };\n}\n\n/**\n * This function gives the product of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains each product of a point of `x` and a point of `y`.\n */\nexport function mul(x: Ball, y: Ball): Ball {\n const m = x.mid * y.mid;\n return { mid: m, rad: productRadius(m, x.mid, x.rad, y.mid, y.rad) };\n}\n\n/**\n * This function gives the quotient of two balls.\n *\n * @param x - The dividend.\n * @param y - The divisor.\n * @returns A ball that contains each quotient of a point of `x` and a point of `y`. A divisor that can hold zero gives\n * the radius `Infinity`.\n */\nexport function div(x: Ball, y: Ball): Ball {\n const q = x.mid / y.mid;\n return { mid: q, rad: quotientRadius(q, x.mid, x.rad, y.mid, y.rad) };\n}\n\n/**\n * This function gives the smallest of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains `min(p, q)` for each point `p` of `x` and `q` of `y`.\n */\nexport function min(x: Ball, y: Ball): Ball {\n const m = Math.min(x.mid, y.mid);\n return { mid: m, rad: claim(m, extremeRadius(-1, x.mid, x.rad, y.mid, y.rad)) };\n}\n\n/**\n * This function gives the largest of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains `max(p, q)` for each point `p` of `x` and `q` of `y`.\n */\nexport function max(x: Ball, y: Ball): Ball {\n const m = Math.max(x.mid, y.mid);\n return { mid: m, rad: claim(m, extremeRadius(1, x.mid, x.rad, y.mid, y.rad)) };\n}\n\n/**\n * This function gives a ball to a whole power, with repeated squares. Each product uses the rule of `mul`. A negative\n * power is the quotient of one by the positive power. The power zero gives one, with the radius zero when the base\n * makes a claim.\n *\n * @param x - The base.\n * @param n - The exponent, a whole number.\n * @returns A ball that contains the power of each point of `x`.\n */\nexport function pow(x: Ball, n: number): Ball {\n if (!Number.isInteger(n)) throw new RangeError(`pow needs a whole exponent, not ${n}.`);\n let bv = x.mid;\n let br = x.rad;\n if (n === 0) return { mid: 1, rad: br < Infinity ? 0 : Infinity };\n let rv = 1;\n let rr = 0;\n let first = true;\n for (let k = Math.abs(n); k > 0; k = Math.floor(k / 2)) {\n if (k % 2 === 1) {\n if (first) {\n rv = bv;\n rr = br;\n first = false;\n } else {\n const m = rv * bv;\n rr = productRadius(m, rv, rr, bv, br);\n rv = m;\n }\n }\n if (k > 1) {\n const s = bv * bv;\n br = productRadius(s, bv, br, bv, br);\n bv = s;\n }\n }\n if (n > 0) return { mid: rv, rad: rr };\n const v = 1 / rv;\n return { mid: v, rad: quotientRadius(v, 1, 0, rv, rr) };\n}\n\n/**\n * This function gives the root of index `k` of a ball.\n *\n * @param x - The radicand.\n * @param k - The index of the root, a whole number of 2 or more.\n * @returns A ball that contains the real root of each point of `x`. An even root of a ball that can hold a negative\n * value gives the radius `Infinity`.\n */\nexport function root(x: Ball, k: number): Ball {\n if (!Number.isInteger(k) || k < 2) throw new RangeError(`root needs a whole index of 2 or more, not ${k}.`);\n const v = floatRoot(x.mid, k);\n return { mid: v, rad: rootRadius(v, x.mid, x.rad, k) };\n}\n\n/** This function decides a comparison of two balls with the outward intervals of the balls. */\nfunction comparison(kind: \"lt\" | \"le\" | \"eq\", x: Ball, y: Ball): Ball {\n if (!(x.rad < Infinity && y.rad < Infinity)) return NO_CLAIM;\n const truth = I[kind](toInterval(x), toInterval(y)) as readonly [number, number];\n if (truth[0] === truth[1]) return { mid: truth[0], rad: 0 };\n const a = x.mid;\n const b = y.mid;\n return { mid: (kind === \"lt\" ? a < b : kind === \"le\" ? a <= b : a === b) ? 1 : 0, rad: 1 };\n}\n\n/**\n * This function compares two balls with `<`.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns The truth value `1` or `0` with the radius zero when the balls decide it. Else the float truth value of\n * the midpoints with the radius one.\n */\nexport function lt(x: Ball, y: Ball): Ball {\n return comparison(\"lt\", x, y);\n}\n\n/**\n * This function compares two balls with `<=`.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns The truth value with the rule of `lt`.\n */\nexport function le(x: Ball, y: Ball): Ball {\n return comparison(\"le\", x, y);\n}\n\n/**\n * This function compares two balls with `=`.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns The truth value with the rule of `lt`.\n */\nexport function eq(x: Ball, y: Ball): Ball {\n return comparison(\"eq\", x, y);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAa,QAAmC,CAAC,WAAW,QAAQ;AAEpE,MAAM,uBAAO,IAAI,yBAAS,IAAI,YAAY,CAAC,CAAC;;;;;;;AAQ5C,SAAgB,OAAO,GAAmB;CACxC,IAAI,OAAO,MAAM,CAAC,KAAK,MAAM,UAAU,OAAO;CAC9C,IAAI,MAAM,GAAG,OAAO,OAAO;CAC3B,KAAK,WAAW,GAAG,CAAC;CACpB,MAAM,OAAO,KAAK,aAAa,CAAC;CAChC,KAAK,aAAa,GAAG,IAAI,IAAI,OAAO,KAAK,OAAO,EAAE;CAClD,OAAO,KAAK,WAAW,CAAC;AAC1B;;;;;;;AAQA,SAAgB,SAAS,GAAmB;CAC1C,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB;;;;;;;;;AAUA,SAAgB,SAAS,GAAW,GAAW,GAAmB;CAChE,IAAI,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO;CAChC,MAAM,KAAK,IAAI;CACf,OAAO,KAAK,IAAI,OAAO,IAAI;AAC7B;AAEA,MAAM,QAAQ;;;;;;;;;;AAWd,SAAgB,aAAa,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AA8C,EAAE,EAAE;CAC1G,MAAM,IAAI,UAAU,EAAE,KAAK,CAAC;CAC5B,OAAO;EAAE,KAAK;EAAG,KAAK,WAAW,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC;CAAE;AACvD;;AAGA,SAAS,WAAW,MAA0B,GAAS,GAAe;CACpE,IAAI,EAAE,EAAE,MAAM,YAAY,EAAE,MAAM,WAAW,OAAO;CACpD,MAAM,QAAQC,iBAAE,KAAK,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC,CAAC;CAClD,IAAI,MAAM,OAAO,MAAM,IAAI,OAAO;EAAE,KAAK,MAAM;EAAI,KAAK;CAAE;CAC1D,MAAM,IAAI,EAAE;CACZ,MAAM,IAAI,EAAE;CACZ,OAAO;EAAE,MAAM,SAAS,OAAO,IAAI,IAAI,SAAS,OAAO,KAAK,IAAI,MAAM,KAAK,IAAI;EAAG,KAAK;CAAE;AAC3F;;;;;;;;;AAUA,SAAgB,GAAG,GAAS,GAAe;CACzC,OAAO,WAAW,MAAM,GAAG,CAAC;AAC9B;;;;;;;;AASA,SAAgB,GAAG,GAAS,GAAe;CACzC,OAAO,WAAW,MAAM,GAAG,CAAC;AAC9B;;;;;;;;AASA,SAAgB,GAAG,GAAS,GAAe;CACzC,OAAO,WAAW,MAAM,GAAG,CAAC;AAC9B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["add","neg","sub","mul","div","pow","root","min","max","lt","le","eq","I.WHOLE","I.add","I.sub","I.sumError","I.productError","I.nextUp","I.quotientIsExact","I.root","I"],"sources":["../src/interval.ts","../src/rounding.ts","../src/ball.ts"],"sourcesContent":["/**\n * Intervals of real numbers with float bounds. Each operation rounds outward, so the exact result of the operation on\n * any reals inside the inputs is inside the output. An infinite bound means that the interval has no bound on that side.\n *\n * `null` is the empty interval: no point of the inputs gives a real value.\n *\n * @packageDocumentation\n */\n\n/** A closed interval `[low, high]` of reals, or `null` for the empty interval. */\nexport type Interval = readonly [number, number] | null;\n\n/** The interval that contains every real. */\nexport const WHOLE: readonly [number, number] = [-Infinity, Infinity];\n\nconst view = new DataView(new ArrayBuffer(8));\n\n/**\n * This function gives the next float above a value.\n *\n * @param x - The value.\n * @returns The smallest float that is larger than `x`. `Infinity` stays `Infinity`, and `NaN` stays `NaN`.\n */\nexport function nextUp(x: number): number {\n if (Number.isNaN(x) || x === Infinity) return x;\n if (x === 0) return Number.MIN_VALUE;\n view.setFloat64(0, x);\n const bits = view.getBigUint64(0);\n view.setBigUint64(0, x > 0 ? bits + 1n : bits - 1n);\n return view.getFloat64(0);\n}\n\n/**\n * This function gives the next float below a value.\n *\n * @param x - The value.\n * @returns The largest float that is smaller than `x`. `-Infinity` stays `-Infinity`, and `NaN` stays `NaN`.\n */\nexport function nextDown(x: number): number {\n return -nextUp(-x);\n}\n\n/**\n * This function gives the exact error of a float sum. It uses the error term of `TwoSum` (Knuth).\n *\n * @param a - The first value.\n * @param b - The second value.\n * @param s - The float sum `a + b`.\n * @returns The float `e` with `a + b = s + e` exactly, or `NaN` when `s` is not finite and the term is not reliable.\n */\nexport function sumError(a: number, b: number, s: number): number {\n if (!Number.isFinite(s)) return Number.NaN;\n const bb = s - a;\n return a - (s - bb) + (b - bb);\n}\n\nconst SPLIT = 134217729; // 2^27 + 1, the constant of the split of Veltkamp.\n\n/**\n * This function gives the exact error of a float product. It uses the error term of `TwoProduct` (Dekker). Near\n * overflow or underflow the term is not reliable, so the function then gives `NaN`.\n *\n * @param a - The first value.\n * @param b - The second value.\n * @param p - The float product `a * b`.\n * @returns The float `e` with `a * b = p + e` exactly, or `NaN` when the term is not reliable.\n */\nexport function productError(a: number, b: number, p: number): number {\n if (a === 0 || b === 0) return 0;\n const m = Math.abs(p);\n if (!(m > 2 ** -900 && m < 2 ** 990) || Math.abs(a) > 2 ** 990 || Math.abs(b) > 2 ** 990) return Number.NaN;\n const ca = SPLIT * a;\n const ah = ca - (ca - a);\n const al = a - ah;\n const cb = SPLIT * b;\n const bh = cb - (cb - b);\n const bl = b - bh;\n return al * bl - (p - ah * bh - al * bh - ah * bl);\n}\n\n/**\n * This function gives a lower bound of `v + e` for a float `v` and its exact error `e`. An exact `v` is the bound.\n * Else the bound is one float lower. Round to nearest puts `v + e` within half a step of `v`, so one step is enough.\n * An error of `NaN` is not known, and it gives the step. The sign of `e` is not used, so that each bound of A1 stays\n * the same.\n */\nconst below = (v: number, e: number): number => (e === 0 ? v : nextDown(v));\n\n/** This function gives an upper bound of `v + e`, with the rule of `below`. */\nconst above = (v: number, e: number): number => (e === 0 ? v : nextUp(v));\n\n/**\n * This function gives the sum of two intervals, rounded outward.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns An interval that contains each sum of a point of `x` and a point of `y`.\n */\nexport function add(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n const lo = x[0] + y[0];\n const hi = x[1] + y[1];\n return [below(lo, sumError(x[0], y[0], lo)), above(hi, sumError(x[1], y[1], hi))];\n}\n\n/**\n * This function gives the negation of an interval. It is exact.\n *\n * @param x - The interval.\n * @returns The interval of the negated points.\n */\nexport function neg(x: Interval): Interval {\n return x === null ? null : [-x[1], -x[0]];\n}\n\n/**\n * This function gives the difference of two intervals, rounded outward.\n *\n * @param x - The first interval.\n * @param y - The interval to subtract.\n * @returns An interval that contains each difference of a point of `x` and a point of `y`.\n */\nexport function sub(x: Interval, y: Interval): Interval {\n return add(x, neg(y));\n}\n\n/**\n * This function gives one float product for an interval bound. A zero times an infinite bound is zero, because the\n * infinite bound stands for large reals, not for infinity.\n */\nfunction boundProduct(a: number, b: number): number {\n return a === 0 || b === 0 ? 0 : a * b;\n}\n\n/**\n * This function gives the product of two intervals, rounded outward.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns An interval that contains each product of a point of `x` and a point of `y`.\n */\nexport function mul(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n let lo = Infinity;\n let hi = -Infinity;\n for (const a of x) {\n for (const b of y) {\n const p = boundProduct(a, b);\n const e = productError(a, b, p);\n lo = Math.min(lo, below(p, e));\n hi = Math.max(hi, above(p, e));\n }\n }\n return [lo, hi];\n}\n\n/**\n * This function tells if a float quotient is exact: the product `q * b` is exact and is `a`.\n *\n * @param a - The dividend.\n * @param b - The divisor.\n * @param q - The float quotient `a / b`.\n * @returns `true` when `q` is the exact quotient.\n */\nexport function quotientIsExact(a: number, b: number, q: number): boolean {\n const p = q * b;\n return p === a && productError(q, b, p) === 0;\n}\n\n/**\n * This function gives the quotient of two intervals, rounded outward. A divisor interval that contains zero gives the\n * whole line, and the point zero gives the empty interval. A quotient of two finite bounds moves one step outward on\n * each side when it is not exact. A quotient with an infinite bound is `0` or infinite, and it is a bound as it is.\n *\n * @param x - The dividend.\n * @param y - The divisor.\n * @returns An interval that contains each quotient of a point of `x` and a nonzero point of `y`.\n */\nexport function div(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (y[0] === 0 && y[1] === 0) return null;\n if (y[0] <= 0 && y[1] >= 0) return WHOLE;\n let lo = Infinity;\n let hi = -Infinity;\n for (const a of x) {\n for (const b of y) {\n if (Number.isFinite(a) && Number.isFinite(b)) {\n const q = a / b;\n const exact = quotientIsExact(a, b, q);\n lo = Math.min(lo, exact ? q : nextDown(q));\n hi = Math.max(hi, exact ? q : nextUp(q));\n } else {\n const q = Number.isFinite(b) ? a / b : Number.isFinite(a) ? 0 : (a > 0) === (b > 0) ? Infinity : -Infinity;\n lo = Math.min(lo, q);\n hi = Math.max(hi, q);\n }\n }\n }\n return [lo, hi];\n}\n\n/**\n * This function gives the square of an interval, rounded outward. It is tighter than `mul(x, x)` for an interval\n * that contains zero.\n */\nfunction square(x: readonly [number, number]): Interval {\n const [a, b] = x;\n if (a >= 0) return mul(x, x);\n if (b <= 0) return mul(neg(x), neg(x));\n const m = Math.max(-a, b);\n const top = mul([m, m], [m, m]);\n return top === null ? null : [0, top[1]];\n}\n\n/**\n * This function gives an interval to a whole power, rounded outward. The power zero gives the point one, also for a\n * base of zero. A negative power is the reciprocal of the positive power.\n *\n * @param x - The base.\n * @param n - The exponent. It must be a whole number.\n * @returns An interval that contains each power of a point of `x`.\n */\nexport function pow(x: Interval, n: number): Interval {\n if (x === null) return null;\n if (!Number.isInteger(n)) throw new RangeError(`pow needs a whole exponent, not ${n}.`);\n if (n < 0) return div([1, 1], pow(x, -n));\n let result: Interval = [1, 1];\n let base: Interval = x;\n for (let k = n; k > 0; k = Math.floor(k / 2)) {\n if (k % 2 === 1) result = mul(result, base);\n if (k > 1 && base !== null) base = square(base);\n }\n return result;\n}\n\n/** This function tells if `r * r` is exactly `a`. */\nfunction isSquareOf(r: number, a: number): boolean {\n const p = r * r;\n return p === a && productError(r, r, p) === 0;\n}\n\n/** This function gives the smallest power of the interval `[z, z]`, rounded downward. */\nfunction powLow(z: number, k: number): number {\n const p = pow([z, z], k);\n return p === null ? Number.NaN : p[0];\n}\n\n/** This function gives the largest power of the interval `[z, z]`, rounded upward. */\nfunction powHigh(z: number, k: number): number {\n const p = pow([z, z], k);\n return p === null ? Number.NaN : p[1];\n}\n\nconst rootOf = (m: number, k: number): number => (k === 3 ? Math.cbrt(m) : Math.pow(m, 1 / k));\n\n/** The most steps of the search of `rootUp` and `rootDown`. After them, each function gives its trivial bound. */\nconst STEPS = 64;\n\n/**\n * This function gives a float `z >= 0` with `z^k >= m`, for `m >= 0`. The check uses the outward powers of `pow`.\n * Near overflow the check cannot pass, and the function gives `Infinity`.\n */\nfunction rootUp(m: number, k: number): number {\n let z = rootOf(m, k);\n for (let i = 0; z < Infinity && i < STEPS; i++) {\n if (powLow(z, k) >= m) return z;\n z = i < 8 ? nextUp(z) : z * (1 + 2 ** (i - 60));\n }\n return Infinity;\n}\n\n/** This function gives a float `z >= 0` with `z^k <= m`, for `m >= 0`. After `STEPS` steps it gives `0`. */\nfunction rootDown(m: number, k: number): number {\n let z = rootOf(m, k);\n if (m === Infinity) return z;\n for (let i = 0; z > 0 && i < STEPS; i++) {\n if (powHigh(z, k) <= m) return z;\n z = i < 8 ? nextDown(z) : z * (1 - 2 ** (i - 60));\n }\n return 0;\n}\n\n/**\n * This function gives the root of an interval, rounded outward. The square root uses `Math.sqrt`, which is correctly\n * rounded, and one step on each bound. A larger index starts from `Math.pow` and moves each bound until the outward\n * power of `pow` shows the side of the bound. The root is monotone, so the bounds of the ends are the bounds. An odd\n * index takes negative points as `-root(-x)`. An even index ignores negative points.\n *\n * @param x - The radicand.\n * @param k - The index of the root. It must be a whole number of 2 or more.\n * @returns An interval that contains the real root of each point of `x` that has one.\n */\nexport function root(x: Interval, k: number): Interval {\n if (x === null) return null;\n if (!Number.isInteger(k) || k < 2) throw new RangeError(`root needs a whole index of 2 or more, not ${k}.`);\n let [a, b] = x;\n if (k % 2 === 0) {\n if (b < 0) return null;\n a = Math.max(a, 0);\n }\n if (k === 2) {\n const lo = Math.sqrt(a);\n const hi = Math.sqrt(b);\n return [isSquareOf(lo, a) ? lo : Math.max(0, nextDown(lo)), isSquareOf(hi, b) ? hi : nextUp(hi)];\n }\n return [a < 0 ? -rootUp(-a, k) : rootDown(a, k), b < 0 ? -rootDown(-b, k) : rootUp(b, k)];\n}\n\n/**\n * This function gives the interval of the smallest of the points. It is exact.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns The interval of `min(p, q)` for `p` in `x` and `q` in `y`.\n */\nexport function min(x: Interval, y: Interval): Interval {\n return x === null || y === null ? null : [Math.min(x[0], y[0]), Math.min(x[1], y[1])];\n}\n\n/**\n * This function gives the interval of the largest of the points. It is exact.\n *\n * @param x - The first interval.\n * @param y - The second interval.\n * @returns The interval of `max(p, q)` for `p` in `x` and `q` in `y`.\n */\nexport function max(x: Interval, y: Interval): Interval {\n return x === null || y === null ? null : [Math.max(x[0], y[0]), Math.max(x[1], y[1])];\n}\n\n/** The interval of a truth value: `1` is true and `0` is false. */\nconst TRUE: Interval = [1, 1];\nconst FALSE: Interval = [0, 0];\nconst UNKNOWN: Interval = [0, 1];\n\n/**\n * This function compares two intervals with `<`. The result is the interval of the truth value, with `1` for true.\n *\n * @param x - The left side.\n * @param y - The right side.\n * @returns `[1, 1]` when `p < q` for each pair of points, `[0, 0]` when for none, and `[0, 1]` when it is not known.\n */\nexport function lt(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (x[1] < y[0]) return TRUE;\n if (x[0] >= y[1]) return FALSE;\n return UNKNOWN;\n}\n\n/**\n * This function compares two intervals with `<=`. The result is the interval of the truth value, with `1` for true.\n *\n * @param x - The left side.\n * @param y - The right side.\n * @returns `[1, 1]` when `p <= q` for each pair of points, `[0, 0]` when for none, and `[0, 1]` when it is not known.\n */\nexport function le(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (x[1] <= y[0]) return TRUE;\n if (x[0] > y[1]) return FALSE;\n return UNKNOWN;\n}\n\n/**\n * This function compares two intervals with `=`. The result is the interval of the truth value, with `1` for true.\n *\n * @param x - The left side.\n * @param y - The right side.\n * @returns `[1, 1]` when both are the same point, `[0, 0]` when they do not meet, and `[0, 1]` when it is not known.\n */\nexport function eq(x: Interval, y: Interval): Interval {\n if (x === null || y === null) return null;\n if (x[0] === x[1] && y[0] === y[1] && x[0] === y[0]) return TRUE;\n if (x[1] < y[0] || y[1] < x[0]) return FALSE;\n return UNKNOWN;\n}\n","/**\n * Directed rounding of nonnegative floats, from the exact error terms of `interval.ts`. Each function gives the\n * correctly rounded result when it is exact, and else the result one float step in the stated direction.\n *\n * @packageDocumentation\n */\nimport { nextDown, nextUp, productError, quotientIsExact, sumError } from \"./interval.ts\";\n\n/**\n * This function gives the sum of two nonnegative floats, rounded upward.\n *\n * @param x - The first value, 0 or more.\n * @param y - The second value, 0 or more.\n * @returns A float that is at least `x + y`, and at most one step above it.\n */\nexport function addUp(x: number, y: number): number {\n const s = x + y;\n return sumError(x, y, s) <= 0 ? s : nextUp(s);\n}\n\n/**\n * This function gives the product of two nonnegative floats, rounded upward.\n *\n * @param x - The first value, 0 or more.\n * @param y - The second value, 0 or more.\n * @returns A float that is at least `x * y`, and at most one step above it.\n */\nexport function mulUp(x: number, y: number): number {\n const p = x * y;\n return productError(x, y, p) <= 0 ? p : nextUp(p);\n}\n\n/**\n * This function gives the quotient of two nonnegative floats, rounded upward. A correctly rounded quotient is at most\n * one step low.\n *\n * @param x - The dividend, 0 or more.\n * @param y - The divisor, above 0.\n * @returns A float that is at least `x / y`, and at most one step above it.\n */\nexport function divUp(x: number, y: number): number {\n const q = x / y;\n return x === 0 || quotientIsExact(x, y, q) ? q : nextUp(q);\n}\n\n/**\n * This function gives the difference `x - y` of two nonnegative floats, rounded downward.\n *\n * @param x - The first value, 0 or more.\n * @param y - The value to subtract, 0 or more.\n * @returns A float that is at most `x - y`, and at most one step below it.\n */\nexport function subDown(x: number, y: number): number {\n const s = x - y;\n return sumError(x, -y, s) >= 0 ? s : nextDown(s);\n}\n\n/**\n * This function gives the float root of index `k`. The square root is correctly rounded. A larger index uses\n * `Math.cbrt` or `Math.pow`, which are not correctly rounded. An odd root of a negative value is negative.\n *\n * @param r - The radicand.\n * @param k - The index of the root, 2 or more.\n * @returns The float root.\n */\nexport function floatRoot(r: number, k: number): number {\n if (k === 2) return Math.sqrt(r);\n const f = (m: number): number => (k === 3 ? Math.cbrt(m) : Math.pow(m, 1 / k));\n return k % 2 === 1 && r < 0 ? -f(-r) : f(r);\n}\n","/**\n * Balls of real numbers: a float midpoint and a float radius, with the \"midrad\" arithmetic of Rump and of Arb. Each\n * function is a plain function of `{ mid, rad }` values. The midpoint of a result is the float result of the same\n * operation on the midpoints. The radius is the propagated radius of the parts plus the error of the rounding of the\n * midpoint. Each operation of the radius rounds upward.\n *\n * A finite radius is a claim. The exact result of the operation on each point of the input balls is at most the\n * radius from the midpoint. A radius of `Infinity` makes no claim. The radius rounds upward by one float step only\n * when its float operation is not exact, so an exact result has the radius zero.\n *\n * Proof sketch of the bound. Let the exact inputs of an operation be `X = a + dx` and `Y = b + dy`, with `|dx| <= ra`\n * and `|dy| <= rb`. Let `m` be the float result and `e` the error of its rounding.\n *\n * - A sum: `X + Y - m = e + dx + dy`, so `ra + rb + |e|` is a radius. `TwoSum` gives `e` exactly.\n * - A product: `XY - m = e + a dy + b dx + dx dy`, so `|a| rb + |b| ra + ra rb + |e|` is a radius. `TwoProduct`\n * gives `e` exactly away from overflow and underflow. Else `u |m| + 2^-1074` bounds `|e|`.\n * - A quotient, with `rb < |b|` so that `Y` is not zero: `X / Y - a / b = (b dx - a dy) / (b Y)`, and\n * `|b Y| >= |b| (|b| - rb)`. So `(ra + |a / b| rb) / (|b| - rb) + |e|` is a radius. Else the radius is `Infinity`.\n * - The smallest and the largest move at most by the largest radius of a part. `min` and `max` are 1-Lipschitz in\n * the largest distance. When the two balls do not meet, the extreme is one of them, so its radius is enough.\n * - A root goes through `interval.root` of `[m - r, m + r]`, rounded outward. The radius is the largest distance from\n * the midpoint to an end. An even root of a ball that holds a negative value has the radius `Infinity`.\n * - A comparison is decided when the outward intervals of the two balls decide it. The midpoint is then the truth\n * value and the radius is zero. Else the radius is one.\n *\n * The radius functions (`sumRadius`, `productRadius`, `quotientRadius`, `extremeRadius` and `rootRadius`) make no\n * object. An evaluator that keeps the midpoint and the radius in two numbers uses them.\n *\n * @packageDocumentation\n */\nimport * as I from \"./interval.ts\";\nimport type { Interval } from \"./interval.ts\";\nimport { addUp, divUp, floatRoot, mulUp, subDown } from \"./rounding.ts\";\n\n/** A ball: the reals at most `rad` from `mid`. */\nexport interface Ball {\n /** The midpoint. */\n readonly mid: number;\n /** The radius. `Infinity` makes no claim. */\n readonly rad: number;\n}\n\nconst U = 2 ** -53;\nconst MIN = Number.MIN_VALUE;\n\n/** The ball that makes no claim. */\nexport const NO_CLAIM: Ball = { mid: Number.NaN, rad: Infinity };\n\n/**\n * This function gives a bound of the error `|e|` of the rounding of a float result `m`. An exact error term `e`\n * gives `|e|`. An error term of `NaN` is not known, and it gives `u |m| + 2^-1074`, rounded upward.\n *\n * @param e - The exact error term, or `NaN`.\n * @param m - The float result.\n * @returns A bound of the error, rounded upward.\n */\nexport function roundingBound(e: number, m: number): number {\n return e === e ? Math.abs(e) : addUp(mulUp(U, Math.abs(m)), MIN);\n}\n\n/**\n * This function keeps a radius as a claim only when the midpoint is finite and the radius is a number.\n *\n * @param m - The midpoint.\n * @param r - The radius.\n * @returns `r`, or `Infinity` when `m` is not finite or `r` is `NaN`.\n */\nexport function claim(m: number, r: number): number {\n return m - m === 0 && r <= Infinity ? r : Infinity;\n}\n\n/**\n * This function makes a ball. A midpoint that is not finite gives the radius `Infinity`.\n *\n * @param mid - The midpoint.\n * @param rad - The radius, 0 or more. The default is 0.\n * @returns The ball.\n * @throws RangeError when the radius is negative or `NaN`.\n */\nexport function ball(mid: number, rad = 0): Ball {\n if (!(rad >= 0)) throw new RangeError(`The radius of a ball must be 0 or more, not ${rad}.`);\n return { mid, rad: claim(mid, rad) };\n}\n\n/**\n * This function gives the interval `[mid - rad, mid + rad]` of a ball, rounded outward.\n *\n * @param x - The ball.\n * @returns An interval that contains each point of the ball. A ball that makes no claim gives the whole line.\n */\nexport function toInterval(x: Ball): Interval {\n if (!(x.rad < Infinity)) return I.WHOLE;\n return I.add([x.mid, x.mid], [-x.rad, x.rad]);\n}\n\n/**\n * This function gives a ball that contains an interval. The midpoint is the float midpoint of the ends, and the\n * radius is the larger distance to an end, rounded upward.\n *\n * @param x - The interval.\n * @returns A ball that contains each point of `x`. The empty interval and an infinite end give `NO_CLAIM`.\n */\nexport function fromInterval(x: Interval): Ball {\n if (x === null || !(x[0] - x[0] === 0 && x[1] - x[1] === 0)) return NO_CLAIM;\n const [lo, hi] = x;\n const mid = lo / 2 + hi / 2;\n const d = I.sub([hi, hi], [mid, mid]) as readonly [number, number];\n const e = I.sub([mid, mid], [lo, lo]) as readonly [number, number];\n return { mid, rad: claim(mid, Math.max(d[1], e[1], 0)) };\n}\n\n/**\n * This function gives the radius of a sum `m = fl(a + b)`.\n *\n * @param m - The float sum of the midpoints.\n * @param a - The first midpoint.\n * @param ra - The first radius.\n * @param b - The second midpoint.\n * @param rb - The second radius.\n * @returns The radius of the sum, rounded upward.\n */\nexport function sumRadius(m: number, a: number, ra: number, b: number, rb: number): number {\n return claim(m, addUp(addUp(ra, rb), roundingBound(I.sumError(a, b, m), m)));\n}\n\n/**\n * This function gives the radius of a product `m = fl(a * b)`.\n *\n * @param m - The float product of the midpoints.\n * @param a - The first midpoint.\n * @param ra - The first radius.\n * @param b - The second midpoint.\n * @param rb - The second radius.\n * @returns The radius of the product, rounded upward.\n */\nexport function productRadius(m: number, a: number, ra: number, b: number, rb: number): number {\n const spread = addUp(addUp(mulUp(Math.abs(a), rb), mulUp(Math.abs(b), ra)), mulUp(ra, rb));\n return claim(m, addUp(spread, roundingBound(I.productError(a, b, m), m)));\n}\n\n/**\n * This function gives the radius of a quotient `q = fl(a / b)`.\n *\n * @param q - The float quotient of the midpoints.\n * @param a - The midpoint of the dividend.\n * @param ra - The radius of the dividend.\n * @param b - The midpoint of the divisor.\n * @param rb - The radius of the divisor.\n * @returns The radius of the quotient, rounded upward, or `Infinity` when the ball of the divisor can hold zero.\n */\nexport function quotientRadius(q: number, a: number, ra: number, b: number, rb: number): number {\n const m = Math.abs(b);\n if (!(rb < m) || !(q - q === 0)) return Infinity;\n const ratio = q === 0 ? 0 : I.nextUp(Math.abs(q));\n const spread = divUp(addUp(ra, mulUp(ratio, rb)), subDown(m, rb));\n const e = I.quotientIsExact(a, b, q) ? 0 : addUp(mulUp(U, Math.abs(q)), MIN);\n return claim(q, addUp(spread, e));\n}\n\n/**\n * This function gives the radius of the largest (`sign = 1`) or the smallest (`sign = -1`) of two balls. When the\n * outward intervals of the balls do not meet, the extreme is one ball, and its radius is the radius. Else the radius\n * is the larger radius.\n *\n * @param sign - `1` for the largest, `-1` for the smallest.\n * @param a - The first midpoint.\n * @param ra - The first radius.\n * @param b - The second midpoint.\n * @param rb - The second radius.\n * @returns The radius of the extreme. Give it to `claim` with the midpoint of the extreme.\n */\nexport function extremeRadius(sign: 1 | -1, a: number, ra: number, b: number, rb: number): number {\n const sa = I.add([sign * a, sign * a], [-ra, ra]) as readonly [number, number];\n const sb = I.add([sign * b, sign * b], [-rb, rb]) as readonly [number, number];\n if (sa[0] >= sb[1]) return ra;\n if (sb[0] >= sa[1]) return rb;\n return Math.max(ra, rb);\n}\n\n/**\n * This function gives the radius of a root `v = floatRoot(r, k)`. The radius is the largest distance from `v` to an\n * end of `interval.root` of the ball of the radicand, rounded upward.\n *\n * @param v - The float root of the midpoint.\n * @param r - The midpoint of the radicand.\n * @param rr - The radius of the radicand.\n * @param k - The index of the root, a whole number of 2 or more.\n * @returns The radius of the root, or `Infinity` when an even root can meet a negative value.\n */\nexport function rootRadius(v: number, r: number, rr: number, k: number): number {\n if (!(rr < Infinity) || !(v - v === 0)) return Infinity;\n const span = I.add([r, r], [-rr, rr]);\n if (span === null || (k % 2 === 0 && span[0] < 0)) return Infinity;\n const d = I.sub([v, v], I.root(span, k));\n return d === null ? Infinity : claim(v, Math.max(-d[0], d[1]));\n}\n\n/**\n * This function gives the sum of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains each sum of a point of `x` and a point of `y`.\n */\nexport function add(x: Ball, y: Ball): Ball {\n const m = x.mid + y.mid;\n return { mid: m, rad: sumRadius(m, x.mid, x.rad, y.mid, y.rad) };\n}\n\n/**\n * This function gives the difference of two balls.\n *\n * @param x - The first ball.\n * @param y - The ball to subtract.\n * @returns A ball that contains each difference of a point of `x` and a point of `y`.\n */\nexport function sub(x: Ball, y: Ball): Ball {\n const m = x.mid - y.mid;\n return { mid: m, rad: sumRadius(m, x.mid, x.rad, -y.mid, y.rad) };\n}\n\n/**\n * This function gives the negative of a ball. It is exact.\n *\n * @param x - The ball.\n * @returns The ball of the negative points.\n */\nexport function neg(x: Ball): Ball {\n return { mid: -x.mid, rad: x.rad };\n}\n\n/**\n * This function gives the product of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains each product of a point of `x` and a point of `y`.\n */\nexport function mul(x: Ball, y: Ball): Ball {\n const m = x.mid * y.mid;\n return { mid: m, rad: productRadius(m, x.mid, x.rad, y.mid, y.rad) };\n}\n\n/**\n * This function gives the quotient of two balls.\n *\n * @param x - The dividend.\n * @param y - The divisor.\n * @returns A ball that contains each quotient of a point of `x` and a point of `y`. A divisor that can hold zero gives\n * the radius `Infinity`.\n */\nexport function div(x: Ball, y: Ball): Ball {\n const q = x.mid / y.mid;\n return { mid: q, rad: quotientRadius(q, x.mid, x.rad, y.mid, y.rad) };\n}\n\n/**\n * This function gives the smallest of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains `min(p, q)` for each point `p` of `x` and `q` of `y`.\n */\nexport function min(x: Ball, y: Ball): Ball {\n const m = Math.min(x.mid, y.mid);\n return { mid: m, rad: claim(m, extremeRadius(-1, x.mid, x.rad, y.mid, y.rad)) };\n}\n\n/**\n * This function gives the largest of two balls.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns A ball that contains `max(p, q)` for each point `p` of `x` and `q` of `y`.\n */\nexport function max(x: Ball, y: Ball): Ball {\n const m = Math.max(x.mid, y.mid);\n return { mid: m, rad: claim(m, extremeRadius(1, x.mid, x.rad, y.mid, y.rad)) };\n}\n\n/**\n * This function gives a ball to a whole power, with repeated squares. Each product uses the rule of `mul`. A negative\n * power is the quotient of one by the positive power. The power zero gives one, with the radius zero when the base\n * makes a claim.\n *\n * @param x - The base.\n * @param n - The exponent, a whole number.\n * @returns A ball that contains the power of each point of `x`.\n */\nexport function pow(x: Ball, n: number): Ball {\n if (!Number.isInteger(n)) throw new RangeError(`pow needs a whole exponent, not ${n}.`);\n let bv = x.mid;\n let br = x.rad;\n if (n === 0) return { mid: 1, rad: br < Infinity ? 0 : Infinity };\n let rv = 1;\n let rr = 0;\n let first = true;\n for (let k = Math.abs(n); k > 0; k = Math.floor(k / 2)) {\n if (k % 2 === 1) {\n if (first) {\n rv = bv;\n rr = br;\n first = false;\n } else {\n const m = rv * bv;\n rr = productRadius(m, rv, rr, bv, br);\n rv = m;\n }\n }\n if (k > 1) {\n const s = bv * bv;\n br = productRadius(s, bv, br, bv, br);\n bv = s;\n }\n }\n if (n > 0) return { mid: rv, rad: rr };\n const v = 1 / rv;\n return { mid: v, rad: quotientRadius(v, 1, 0, rv, rr) };\n}\n\n/**\n * This function gives the root of index `k` of a ball.\n *\n * @param x - The radicand.\n * @param k - The index of the root, a whole number of 2 or more.\n * @returns A ball that contains the real root of each point of `x`. An even root of a ball that can hold a negative\n * value gives the radius `Infinity`.\n */\nexport function root(x: Ball, k: number): Ball {\n if (!Number.isInteger(k) || k < 2) throw new RangeError(`root needs a whole index of 2 or more, not ${k}.`);\n const v = floatRoot(x.mid, k);\n return { mid: v, rad: rootRadius(v, x.mid, x.rad, k) };\n}\n\n/** This function decides a comparison of two balls with the outward intervals of the balls. */\nfunction comparison(kind: \"lt\" | \"le\" | \"eq\", x: Ball, y: Ball): Ball {\n if (!(x.rad < Infinity && y.rad < Infinity)) return NO_CLAIM;\n const truth = I[kind](toInterval(x), toInterval(y)) as readonly [number, number];\n if (truth[0] === truth[1]) return { mid: truth[0], rad: 0 };\n const a = x.mid;\n const b = y.mid;\n return { mid: (kind === \"lt\" ? a < b : kind === \"le\" ? a <= b : a === b) ? 1 : 0, rad: 1 };\n}\n\n/**\n * This function compares two balls with `<`.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns The truth value `1` or `0` with the radius zero when the balls decide it. Else the float truth value of\n * the midpoints with the radius one.\n */\nexport function lt(x: Ball, y: Ball): Ball {\n return comparison(\"lt\", x, y);\n}\n\n/**\n * This function compares two balls with `<=`.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns The truth value with the rule of `lt`.\n */\nexport function le(x: Ball, y: Ball): Ball {\n return comparison(\"le\", x, y);\n}\n\n/**\n * This function compares two balls with `=`.\n *\n * @param x - The first ball.\n * @param y - The second ball.\n * @returns The truth value with the rule of `lt`.\n */\nexport function eq(x: Ball, y: Ball): Ball {\n return comparison(\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SAAS,OAAO,KAAK,IAAI,MAAM,KAAK,IAAI;EAAG,KAAK;CAAE;AAC3F;;;;;;;;;AAUA,SAAgB,GAAG,GAAS,GAAe;CACzC,OAAO,WAAW,MAAM,GAAG,CAAC;AAC9B;;;;;;;;AASA,SAAgB,GAAG,GAAS,GAAe;CACzC,OAAO,WAAW,MAAM,GAAG,CAAC;AAC9B;;;;;;;;AASA,SAAgB,GAAG,GAAS,GAAe;CACzC,OAAO,WAAW,MAAM,GAAG,CAAC;AAC9B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/interval",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Float error bounds: outward-rounded intervals, midpoint-radius balls, nextUp and nextDown, and the error-free transforms of a sum and a product.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"interval-arithmetic",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@mark1russell7/cue": "^2.1.1",
|
|
52
|
-
"@mark1russell7/rational": "0.1.
|
|
53
|
-
"@mark1russell7/rigor-generators": "^0.
|
|
52
|
+
"@mark1russell7/rational": "0.1.3",
|
|
53
|
+
"@mark1russell7/rigor-generators": "^0.2.0",
|
|
54
54
|
"@mark1russell7/rigor-statistics": "^0.2.1",
|
|
55
55
|
"@types/node": "^26.6.5",
|
|
56
56
|
"fast-check": "^4.10.2",
|