ADR 0006: Precision policy — template on RealType, instantiate double¶
Status¶
Accepted (2026-07-23).
Context¶
The audit (§17.3) noted the codebase is effectively double-only today, while
the tungsten GPU model already templates on RealType (and a latent
float-instantiation bug surfaced in Pre-M0 PA when the sync hooks became
virtual). Retrofitting a precision parameter after the fact is the expensive
direction; introducing it up front is cheap.
Decision¶
New 0.2 core types —
Field<T, MemorySpace>,SimulationState, steppers, spatial operators — are templated onRealType(the scalar type), from their introduction (M1/M2/M6).For 0.2 we instantiate and test
doubleonly.float(and mixed precision) must compile but are not validated; no baseline covers them.Host mirrors and I/O paths must not assume a fixed scalar type: convert explicitly between
RealTypeand any fixed-type sink (as Pre-M0 PA now does for the tungsten host mirror) rather than assumingdouble.
Consequences¶
The template parameter exists everywhere from day one, so a later
floator mixed-precision effort is instantiation + validation work, not a refactor.CI and baselines (
tests/baselines/BASELINES.md) coverdouble; afloatclaim requires new baselines and is out of scope for 0.2.Explicit-conversion discipline at type boundaries (mirrors, writers, checkpoint) is a review checklist item.