Skip to content

Accuracy contract: stated error bounds against a math/big oracle - #114

Merged
tannevaled merged 3 commits into
mainfrom
docs/accuracy-contract
Nov 12, 2026
Merged

tannevaled merged 3 commits into
mainfrom
docs/accuracy-contract

Conversation

@tannevaled

@tannevaled tannevaled commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Adds the accuracy contract, following the fleet rule of 2026-11-11 (model: Refs go-fft/fft#121): bit identity with NumPy was a porting step, and the contract is now a stated error bound checked against an exact oracle. This is step 1 of that order, so no behaviour changes.

  • README: a new "Accuracy contract" section with Bound / Oracle / Exact.
  • accuracy_bound_test.go:
    • TestAccuracyBoundSum checks Sum in float64 and float32 at n from 1 to 2²⁰ against math/big at 1024 bits, with Higham's γ_d bound for the rounding depth of NumPy's pairwise sum.
    • TestAccuracyBoundMatMul checks every element of MatMul in float64 and float32 (shapes from 1×1×1 to 256³) against the γ_k·(|A|·|B|) bound, which holds for any summation order, with or without FMA.

Mutation check: with the oracle computed over xs[1:] (one element dropped), TestAccuracyBoundSum fails at all seven sizes. The input range is 2^±4, so the bound stays below the smallest element.

paritycheck repo .: it FAILed on main (statements such as README "bit-identical to np.sum" with no marker) and PASSes on this branch.

What follows, one PR per lever, each measured and landing only if faster and within the bound: faster default orders for Sum and Dot, and FMA where it pays. The current arithmetic stays available as an option.

🤖 Generated with Claude Code

tannevaled and others added 3 commits November 12, 2026 11:24
…for Sum and MatMul

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…og figures as stated by floats

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 9e9ef29 into main Nov 12, 2026
13 checks passed
@tannevaled
tannevaled deleted the docs/accuracy-contract branch November 12, 2026 10:40
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