/** * Interval arithmetic with outward rounding. * * `Interval` (constructed via the `interval(lo, hi)` factory) implements * rigorous interval arithmetic: every operation guarantees the true * mathematical result over any pair of real inputs drawn from the operand * intervals is contained in the returned interval. JavaScript has no access * to IEEE-754 directed rounding modes (round-toward-negative-infinity / * round-toward-positive-infinity), so as a practical surrogate every result * is nudged outward by a tiny relative epsilon (`Number.EPSILON`) plus one * ULP (`Number.MIN_VALUE`) after each operation: `lo` is decreased and `hi` * is increased. This is the same idea underlying mpmath's `iv` module and * MATLAB's INTLAB — a verified-bounds numeric type, the first in this * library. * * @packageDocumentation */ /** * A closed real interval `[lo, hi]` with outward-rounded arithmetic. * * Construct via the {@link interval} factory rather than `new Interval(...)` * directly (both work; the factory reads more naturally at call sites). */ export declare class Interval { readonly lo: number; readonly hi: number; constructor(lo: number, hi: number); /** `[this.lo + b.lo, this.hi + b.hi]`, outward-rounded. */ add(b: Interval): Interval; /** `[this.lo - b.hi, this.hi - b.lo]`, outward-rounded. */ sub(b: Interval): Interval; /** * Interval product: the min/max of all four endpoint products * (`lo*lo, lo*hi, hi*lo, hi*hi`), outward-rounded. Correct for any * combination of signs. */ mul(b: Interval): Interval; /** * Interval quotient. Throws if `b` contains 0 (division would be * unbounded). Otherwise the min/max of the four endpoint quotients, * outward-rounded. */ div(b: Interval): Interval; /** `[-this.hi, -this.lo]`, outward-rounded. */ neg(): Interval; /** `hi - lo`. */ width(): number; /** `(lo + hi) / 2`. */ mid(): number; /** Whether the closed interval `[lo, hi]` contains the real number `x`. */ contains(x: number): boolean; /** * Square root, monotonic-increasing over `[0, +Infinity)`. Throws if the * interval contains negative values (real square root is undefined there). */ sqrt(): Interval; /** Exponential, monotonic-increasing over all reals. */ exp(): Interval; /** * Natural log, monotonic-increasing over `(0, +Infinity)`. Throws if the * interval is not strictly positive. */ log(): Interval; /** * Integer power `x^n`, monotonic-aware: * - `n` odd: `x^n` is monotonic-increasing over all reals, so the result is * `[lo^n, hi^n]`. * - `n` even, interval entirely non-negative: monotonic-increasing, so * `[lo^n, hi^n]`. * - `n` even, interval entirely non-positive: monotonic-decreasing (in * magnitude, toward zero), so `[hi^n, lo^n]`. * - `n` even, interval spans zero: the minimum is `0` (attained at `x=0`) * and the maximum is `max(|lo|, |hi|)^n`. * - `n` negative: computed as the reciprocal of `pow(-n)`; throws if that * positive-power interval contains zero (division by zero). * - `n = 0`: `[1, 1]` for every interval. * * Throws if `n` is not an integer. */ pow(n: number): Interval; } /** Construct an `Interval([lo, hi])`. Throws if `lo > hi`. */ export declare function interval(lo: number, hi: number): Interval; //# sourceMappingURL=interval.d.ts.map