/** * f32-canonical boundary comparison seam (CUT B1.5). * * The WASM batch kernel (crates/czap-compute/src/boundary.rs) evaluates * boundaries in f32, and `WASMDispatch.batchBoundaryEval` down-casts thresholds * and values to f32 (Float32Array) before the call. The JS scalar path and the * JS batch fallback historically compared in f64 — so a value within * ~1e-7 of a threshold could resolve to a DIFFERENT state index depending on * whether WASM was loaded (output-identity drift). * * The fix: ONE seam that rounds to f32 (matching the deployed WASM semantics), * applied to raw state selection in the scalar path AND the batch fallback. We * make JS conform to the f32 WASM that actually runs in production rather than * migrate the kernel to f64 (which would require rebuilding an out-of-repo .wasm * artifact in lockstep — a worse, unverifiable hazard). See * tests/unit/core/boundary-f32-parity.test.ts. * * @module */ /** Round a boundary signal/threshold to f32, matching the WASM kernel's precision. */ export declare function toBoundaryF32(value: number): number; /** * The single f32-canonical state-index kernel. * * Returns the index of the state a `value` falls into: the largest `i` where * `thresholds[i] <= value` (in f32), or `0` when the value is below every * threshold. Thresholds are assumed strictly ascending (guaranteed by * `Boundary.make`). Uses an unrolled fast path for small arrays (≤4) and binary * search beyond — both equivalent to a linear reverse-scan for sorted input, so * `EVALUATE_THRESHOLDS_SOURCE` (the worker blob twin, a linear reverse-scan) and * `fallbackKernels.batchBoundaryEval` agree with this on every input. * * This is THE numeric semantics for boundary evaluation across the whole repo: * scalar (`Boundary.evaluate`/`evaluateResult`), the JS batch fallback, the * worker inline string, and the host startup twin all route through it (or its * string mirror). Cross-path agreement is locked by * `tests/property/boundary-evaluator-parity.prop.test.ts`. */ export declare function rawIndexF32(thresholds: ArrayLike, value: number): number; /** * Worker-blob twin of {@link rawIndexF32}, as an inlinable JavaScript source string. * * Worker blob scripts run in a classic Worker created from a Blob and cannot use * ES module imports, so the threshold-evaluation logic must be embedded as a * string. This is the single source of that string — `@czap/worker`'s * `render-worker` and `compositor` blob scripts both interpolate it, so they * cannot drift from each other. It is a linear reverse-scan, f32-canonical * (`Math.fround`) to match {@link rawIndexF32} and the deployed WASM kernel. * * Stateless by design: the worker never owns hysteresis/transition state (the * host reconciles crossings via `apply-resolved-state`), so the signature is * `(thresholds, states, value)` with no previous-state argument. * * The property test executes this string via `new Function(...)` and asserts it * agrees with `rawIndexF32` on every golden/edge vector — that execution IS the * anti-drift guarantee. */ export declare const EVALUATE_THRESHOLDS_SOURCE = "/**\n * Evaluate which discrete state a value falls into based on thresholds.\n * f32-canonical (Math.fround); thresholds sorted ascending; value below all\n * thresholds maps to the first state.\n *\n * Canonical kernel: packages/core/src/boundary-f32.ts (rawIndexF32).\n *\n * @param {number[]} thresholds\n * @param {string[]} states\n * @param {number} value\n * @returns {string}\n */\nfunction evaluateThresholds(thresholds, states, value) {\n const v = Math.fround(value);\n for (let i = thresholds.length - 1; i >= 0; i--) {\n if (v >= Math.fround(thresholds[i])) {\n return states[i] || states[0] || \"\";\n }\n }\n return states[0] || \"\";\n}"; //# sourceMappingURL=boundary-f32.d.ts.map