Skip to content

Numerical and execution contracts

These pages define behavior at the API boundary. Start with the operation guide for examples, then consult the relevant contract for edge cases. These contracts describe current behavior; dated measurements are kept in the verification archive.

ContractWhat it specifies
Floating point and masksRounding, NaN, signed zero, canonical masks, selection and mixed aliases
Reductions and scansFixed accumulation order, empty inputs, error budgets, ddof and combinations
Types and conversionsf64 precision, integer wrap/saturation, shifts, conversion pairs and atomic errors
Advanced mathematicsDomains, special values, libm configuration, MPFR oracle and ULP budgets
PipelinesSupported nodes, serialization, strict precision, bounded caches and aliases
WorkersInput snapshots, task states, cancellation, byte budgets and recovery

Rules shared by every API

  • Inputs are one-dimensional, contiguous TypedArrays or matching resident handles.
  • Types do not promote implicitly. Default outputs are independent copies; out explicitly selects an existing destination where supported.
  • Same-type exact output aliases are allowed where registered. Partial overlap and cross-type output overlap are rejected before writing.
  • Basic arithmetic preserves each step's precision; integer arithmetic wraps unless the operation explicitly requests saturation. There is no implicit FMA or fast-math.
  • NaN payloads are unspecified. Documented signed-zero and infinity behavior remains observable.
  • from/set/toArray copy data; disposal invalidates owned handles.
  • scope is synchronous. Use a persistent arena for application lifetimes across frames, and a Worker executor for supported asynchronous calculations.
  • simd: 'required' constrains engine initialization. Inspect each operation with getCapability to distinguish explicit SIMD from scalar fallback.

Compatibility

Numeric types use independent namespaces and explicit conversions. Broadcast, output reuse and resident-buffer patterns are shared where supported. Workers provide a separate entry point for asynchronous pipeline execution.

JS, native, Wasm and Worker assets must be deployed together. ABI v6 and registry fingerprint handshakes reject incompatible assets. Serialized pipeline plans also bind to the operation fingerprint. Invalid types, lengths, overlaps, lifetimes and plans fail explicitly; complete error message text is not a stable contract.

Released under the MIT License.