Skip to content

Specify the accuracy-class evaluation contract in PM 1004 - #18

Merged
ronaldtse merged 1 commit into
mainfrom
docs/evaluation-accuracy
Nov 3, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
docs/evaluation-accuracy

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Implements the agreed evaluation-accuracy design in the spec: values carry accuracy classes (exact integers and rationals; limited floats with undeclared accuracy; limited guard-digit decimals; limited contaminates exact), boundaries are the operations that would discard exactness, and the caller chooses the mode at the entry point:

  • approximate (default) — every boundary crossed, every crossing reported;
  • strict — never crosses; defers at the first boundary with the residual expression (partially evaluated, undiminished accuracy);
  • strict + guard_digits — crosses by computing a BigDecimal result to the declared precision; unsupported functions raise a typed error.

Evaluation returns a result object (value, ordered boundary records, unevaluated expressions); exact vectors are byte-identical across runtimes. Companion implementation PR lands in plurimath/plurimath.

Test plan

  • ruby scripts/validate-register.rb — VALIDATION OK (6 documents)
  • metanorma compile of pm-1004 — new clauses render (Accuracy classes / Boundaries / Modes / Results)
  • Reviewer: check the Modes section wording against the intended caller contract

Replace the platform-precision clause with the accuracy model: values
carry accuracy classes (exact integers and rationals, limited floats
and guard-digit decimals, limited contaminating exact); boundaries are
the operations that would discard exactness; the caller chooses the
mode - approximate (default, every boundary crossed and reported),
strict (never crosses, defers with the residual expression), or strict
with declared guard digits (BigDecimal to the declared precision).
Results are objects carrying the value, the boundary records and the
unevaluated expressions; exact vectors are byte-identical across
runtimes.
@ronaldtse
ronaldtse merged commit 4b4b57c into main Nov 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant