Skip to content

Allow exact bit precision in native coefficient evaluation - #14

Open
huashengshao wants to merge 1 commit into
codex/native-loop-preparationfrom
codex/native-bit-precision
Open

huashengshao wants to merge 1 commit into
codex/native-loop-preparationfrom
codex/native-bit-precision

Conversation

@huashengshao

Copy link
Copy Markdown

Native coefficient callers currently select arbitrary precision through decimal digit counts, which cannot express every requested binary working precision. Add CoefficientEvaluator::with_precision_bits(state, arithmetic, bits) to select the existing executor directly: Double requires 53 bits, DoubleDouble requires 106, and Arbitrary accepts at least two bits, including 113 and nonstandard bit counts. The legacy string/decimal constructor parses its existing arguments and delegates to this constructor; there is no second evaluator, decimal conversion, hidden guard precision, or dependency change.

The requested bits set the initial working precision. Numerica Float still propagates precision through arithmetic and may reduce it after cancellation; typed inputs must use the selected carrier and working precision.

Validation: cargo test -p rusticol-loop-reduction --test runtime_precision_bits --offline -j1 passed all three tests. A native exact saved state containing (1+2^-80)*(1+i) retains the sub-binary64 coefficient at 113, 137 and 257 bits, with assertions on the actual real and imaginary component precision in both scalar and multirow execution. Additional checks cover fixed-carrier equivalence with the legacy constructor, legacy decimal selection, the two-bit minimum, and rejection of incompatible fixed-carrier requests or zero/one arbitrary bits. Changed Rust files are formatted and the diff passes whitespace checks.

This change is based on the native evaluator preparation in PR #7 (commit 1c4fe375).

This branch has not been deployed

No deployments
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.

2 participants