exhaustive_sweep¶
Exhaustive accuracy sweeps for the fixed-point transcendental datapaths.
A bound is only ever what was actually swept. This arc has four recorded cases of a sample declaring a datapath flawless that the full domain disproved – Q48/degree-5 exp, the 256-segment CDF, ln at 60,000 samples, and ln again at 663,000 – so a registered accuracy fact comes from here, not from a stratified sample.
THE COST IS THE REFERENCE, NOT THE DATAPATH. ln_reference and its siblings compute in 80 decimal digits so that half-way cases double cannot decide are decided correctly. Calling that for every input puts a full 2**31 sweep in the tens of core-hours (an estimate from the per-input cost when this was written, not a timed run). Deciding in double and re-deciding only the inputs that sit too close to a rounding boundary brings it down to minutes on a workstation, because only a few thousand inputs are close. Both answers are identical; only one is affordable enough to run on every candidate operating point.
This module was written after the slow estimate had sent a candidate light point to the back of the queue as a multi-session task. It is committed so the capability is not rediscovered a third time.
Attributes¶
Classes¶
What an exhaustive sweep establishes about one operating point. |
Functions¶
|
Compare a datapath against its mathematical reference over |
Module Contents¶
- exhaustive_sweep.BOUNDARY_GUARD = 1e-06¶
- class exhaustive_sweep.SweepResult(worst: int, wrong: int, checked: int, first: int | None, boundary: int)¶
What an exhaustive sweep establishes about one operating point.
- property faithful: bool¶
Never more than one ULP from the correctly rounded answer.
- property correctly_rounded: bool¶
- __repr__() str¶
- exhaustive_sweep.sweep(evaluate: collections.abc.Callable[[int], int], reference: collections.abc.Callable[[int], int], values: collections.abc.Iterable[int], *, scale: int, transform: collections.abc.Callable[[float], float] = math.log, guard: float = BOUNDARY_GUARD) SweepResult¶
Compare a datapath against its mathematical reference over
values.transformis the real-valued function in double precision; the exactreferenceis consulted only where double cannot decide the rounding. The two-tier split is what makes a full-domain sweep affordable – see the module docstring.