Docs/Numerics

Choose the number system before the backend.

Cross-backend authority starts with width, format, rounding, overflow, and approximation policy. runD exposes separate surfaces for Compute state, raw vector lanes, and evidence.

32/64-bit integerFixedMath32/Math64Evidence

Choose by where the value lives

NeedEntryContract
Authoritative values inside one CPU/GPU Flow<rund/compute.hpp>int32_t, uint32_t, int64_t, uint64_t, or compute::Fixed<I,F>.
Composite Compute math and matrices<rund/compute/math.hpp>The same canonical Flow and numeric policy; no second graph language.
Deterministic real-time SIMD and vector helpers<math32/math32.hpp>32-bit lanes and raw signed Q1.31 formulas.
Widened high-precision SIMD and vector helpers<math64/math64.hpp>64-bit lanes and raw signed Q1.63 formulas.
Portable numeric-policy identity and text<rund/evidence.hpp>Validated Contract, stable Id, encode, and decode.
There is no <rund/fixed.hpp> Stored cross-backend Fixed values belong to Compute. Math32 and Math64 expose raw fixed-lane formulas, not another stored fixed value type.

Compute Fixed makes storage policy explicit

Fixed construction · contextual fragment
using State = rund::compute::Fixed<16, 16>;

const State half = State::ratio<1, 2>();
const State one = State::from_raw(1 << 16);

A stored Fixed format has exactly 32 or 64 bits. Intermediate expressions may widen, but every precision-losing storage boundary uses explicit quantize<T>(). Format, rounding, overflow, and approximation policy participate in graph and Program identity.

  • Implicit conversion to or from float and double is rejected.
  • Mixed Fixed formats do not combine implicitly.
  • Integer and Fixed expression domains remain distinct.
  • CPU, Metal, and Vulkan lower the same admitted expression opcodes.

Math32 and Math64 own raw vector lanes

FamilyMath32Math64
Fixed laneSigned Q1.31Signed Q1.63
SIMDI32/U32 lanes and masksI64/U64 lanes and masks
Common helpersSaturating arithmetic, fixed multiply/divide, nonlinear/turn math, statistics, geometry, SoA, quantization, neural, probability, and recurrence families.
Typical choiceReal-time and quantized workloadsWidened precision and larger accumulation range

Pure functions return values directly. Prepared ranges, quantization, probability, and other validating helpers expose a status or result; check it before using output storage.

Encode the numeric contract you actually used

numeric evidence · contextual fragment
#include <rund/evidence.hpp>

const auto numeric =
    rund::evidence::make(rund::evidence::fixed<16, 16>());
if (!numeric) return numeric.exit_code();

const auto text = rund::evidence::encode(numeric);
const auto decoded = rund::evidence::decode(text);
if (!decoded) return decoded.exit_code();

return decoded.id() == numeric.id() ? 0 : 2;

Start from a preset such as i32(), i64(), fixed<I,F>(), or a strict/diagnostic/presentation floating-point preset. Numeric::Code is the outcome authority; identity and contract observers are meaningful only after success.

Know where exact authority stops

  • Public Compute currently excludes floating-point inputs even though the broader evidence model can describe strict floating-point policy.
  • Diagnostic or presentation floating point cannot feed authoritative state.
  • Native SIMD width is a physical implementation detail; lane formulas and output bits are the contract.
  • An unsupported format or policy combination fails admission instead of selecting a weaker rule.

Read Determinism for graph and ordering scope, then Compute for the bounded expression language.

Next referenceFind every public entry and result family