Skip to main content

Module math

Module math 

Source
Expand description

Math intrinsics — partial migration to typed marshal layer.

Per the intrinsics-typed-CC migration’s partial-migration pattern (see docs/defections.md 2026-05-07 zero-copy entry’s per-storage-variant correction subsection + intrinsics-typed-CC entry’s Q2 lifecycle subsection), 14 of math.rs’s 19 intrinsics migrate to register_typed_fn_N typed entries via create_math_intrinsics_module. 4 polymorphic intrinsics remain as legacy IntrinsicFn bodies pending follow-on architectural sub-decisions:

  • intrinsic_min / intrinsic_max: polymorphic return (i64 for Vec<int> fast path vs f64 for Vec<number>). Single typed entry can’t carry both. Awaits M1-split sub-decision (per-element-type intrinsics; cross-crate change to shape-vm compiler emission + opcode discriminants + classification logic).
  • intrinsic_sum deleted (W12-stdlib-intrinsic-collapse, Wave-2-Agent-G, 2026-05-14): stdlib pub fn sum(series) now routes through PHF method dispatch (series.sum()) — single discriminator per ADR-005 §1, MethodFnV2 ABI per ADR-006 §2.7.10/Q11.
  • intrinsic_char_code: polymorphic input (Char vs String). HeapValue::Char is first-class post-bulldozer (heap_value.rs:846) so dropping the Char branch would break callers iterating for c in s.chars(). Awaits multi-input-type dispatch sub- decision.
  • intrinsic_bspline2_3d_batch: 11-arg with FloatArray fast path AND generic-array slow path. Slow path uses to_generic() which is removed; consumer audit of math.shape:243 wrapper + user-code needed before deciding fast-path-only-vs-keep-slow-path.

Migrated entries take Arc<Vec<f64>> (for Vec<number> aggregations) or f64 (for trig family + from_char_code) typed inputs and return ConcreteReturn::F64 / ConcreteReturn::String per the dispatcher’s TypedReturn → slot push projection.

Functions§

create_math_intrinsics_module
Create the math intrinsics module with 14 typed-marshal entry points. The 4 polymorphic intrinsics (min, max, char_code, bspline2_3d_batch) remain as legacy IntrinsicFn bodies in this module until their follow-on architectural sub-decisions land. sum was deleted by W12-stdlib-intrinsic-collapse (Wave-2-Agent-G, 2026-05-14) — stdlib now routes through PHF .sum() method dispatch.
intrinsic_bspline2_3d_batch
Intrinsic: Batched quadratic B-spline interpolation on a 3D grid.
intrinsic_char_code
Intrinsic: Get the Unicode code point of a single character.
intrinsic_max
Intrinsic: Maximum value in a series or among multi-scalar arguments.
intrinsic_min
Intrinsic: Minimum value in a series or among multi-scalar arguments.