Skip to content

Reject unsupported ranges in floating-point error tracking - #9

Open
ValentinHirschi wants to merge 1 commit into
symbolica-dev:mainfrom
ValentinHirschi:codex/epf-range-refusal
Open

ValentinHirschi wants to merge 1 commit into
symbolica-dev:mainfrom
ValentinHirschi:codex/epf-range-refusal

Conversation

@ValentinHirschi

Copy link
Copy Markdown
Contributor

A tracked value can silently lose its entire uncertainty when it is scaled down and back up, although the final central value returns to one:

let seed = ErrorPropagatingFloat::new(Float::with_val(512, 1), 150.);
let exact = |x| ErrorPropagatingFloat::new_with_accuracy(
    Float::with_val(512, x), f64::INFINITY);
let result = seed * exact(1e-200) * exact(1e200);
// Before: central value ≈ 1, absolute error == 0.
// After: central value ≈ 1, absolute error is NaN.

Keep the existing f64 absolute-error field and mark unsupported tracking ranges as NaN. Checked arithmetic and native-scale conversions prevent nonzero uncertainty from underflowing into an exact zero; truncation preserves invalid tracking. Callers must check the uncertainty separately from the central value. This does not provide wider-range or certified arithmetic.

The same checks cover constructors, constants, rational scaling and elementary-function sensitivities. In particular, negative rational conversion keeps a nonnegative error, tanh avoids a rounded 1-tanh² derivative, and powf evaluates the near-one logarithmic sensitivity in the native domain. The documented explicit set_precision reset remains an intentional replacement of the tracking assumption; an unrepresentable new assumption is invalid. Explicit infinite accuracy still denotes an intentionally exact input.

Validation:

  • Unchanged latest main (a8a8fcb): all nine new regression groups fail.
  • GMP/MPFR: 174 library tests, 14 existing integration tests and nine new groups pass.
  • Malachite/Astro: 151 library tests, 14 existing integration tests and nine new groups pass.
  • Formatting and diff checks pass. Upstream-wide strict Clippy has 130 existing findings; comparison shows no new library diagnostics, and the new tests have no Clippy warnings.

The tests cover scale-down/up and late amplification, deep precision, native and tracking underflow, sticky invalidity, near-one/saturated sensitivities, precision reset, negative rationals, ordinary tracking and genuine zero controls.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ValentinHirschi

Copy link
Copy Markdown
Contributor Author

@benruijl Could you review this error-tracking range fix? The automatic reviewer assignment was rejected because my fork account lacks the repository permission. Native and portable gates pass; the description records the baseline reproductions and scope.

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