Repository navigation
Build phase-1 PR 1: one name per quantity, input codes, the failure order - #14
Merged
Merged
Conversation
…rder Steps (1)-(3) of the phase-1 row of DESIGN §10.3, as revised in §12.21: - B7 (§6.3): failure::where becomes by and fault::evals becomes evaluations; nxx::best(r) returns the solution's estimate or the failure's best as one optional, with a reasoned deletion for a search result; best_x names its remedy in a comment; detail::is_result_v. - B4 (§6.3, §6.7, §7.1): a NaN or infinite input fails with non_finite_input, equal ends with invalid_input; the non-finite diff x. A nested Numerixx callable's input code is mapped to non_finite_value inside nxx::evaluate (§12 item 22, decided during review: before, one raised in prepare or init was identical to the solver's own rejection, so stop-on-input chains depended on order); checked_step stays as the backstop for a user-written step. - B6 (§6.6, §6.7, §7.2): nxx::better_than as the order's customisation point, merit_of removed, the protocol requirement; R3 by width (the halves only when both widths overflow, a NaN |f| last), a strict weak order that never prefers a wider enclosure; the sign_bracket precondition; a pole failure carries its estimate without the enclosure, so first_of no longer ranks the pole as best. Fixed on the way, each reproduced first: - then and warm_fallback map a stage-2 input code to non_finite_value, and a then failure keeps stage 1's estimate, except after a pole (§12 item 23); warm_fallback no longer restarts an open method at a detected pole, which reported the pole as a success (rule 5). - cl laid a left-nested first_of over itself (two stacked [[msvc::no_unique_address]] members) and gave wrong results; first_of_t::policy_ drops the attribute. cl and clang-cl still lay out nxx::options differently, so mixing them is documented as unsupported. Pole false successes that remain through chains, and the pole check's endpoint gap, are documented as known limits with measured rows and assigned to the phase-3 open-method safeguards (§6.10, §7.2, §10.3). Reviewed by cpp-, numerics-, simplicity-, phase-scope- and docs-reviewers over four fix rounds. All 12 presets pass from a fresh configure (299 tests; 297 on msvc, 310 with multiprecision, 8 on integration), and the golden table is unchanged. Source: Numerixx 1.x v1.1.0-legacy for the MIGRATION citation only; no external code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Cross-platform numerical ordering, public error semantics, and composition changes warrant final maintainer review.
Review effort: Balanced
Findings: None
What changed in this PR
Implements phase 1’s first build step for Numerixx’s shared result types, input errors, and failure-estimate ordering.
Changes:
- Unifies diagnostic field names and adds
nxx::best. - Normalizes nested input errors and improves staged failure handling.
- Updates numerical ordering, fixes MSVC chain layout, and adds regression coverage.
| File | Description |
|---|---|
| tests/usage/test_regularity.cpp | Uses renamed failure field. |
| tests/usage/test_composition.cpp | Tests nested error mapping. |
| tests/usage/canonical_calls.cpp | Adds canonical best usage. |
| tests/structural/consumer_warnings.cpp | Exercises best in consumer checks. |
| tests/roots/test_steps.cpp | Tests step-error normalization. |
| tests/roots/test_solvers.cpp | Updates input and pole checks. |
| tests/roots/test_results.cpp | Tests result helpers. |
| tests/roots/test_order.cpp | Tests ordering properties and extremes. |
| tests/roots/test_determinism.cpp | Updates names; preserves golden values. |
| tests/roots/test_combinators.cpp | Adds composition and layout regressions. |
| tests/roots/test_any_solver.cpp | Updates failure-field assertions. |
| tests/pipes/test_pipes.cpp | Uses unified algorithm field. |
| tests/multiprecision/test_multiprecision.cpp | Covers multiprecision errors and ordering. |
| tests/deriv/test_deriv.cpp | Tests non-finite derivative inputs. |
| tests/core/test_refined.cpp | Tests bracket error distinctions. |
| tests/core/test_criteria.cpp | Tests ordering customization requirements. |
| tests/compile_fail/solver_without_better_than.cpp | Checks missing-order diagnostics. |
| tests/compile_fail/compile_fail.cmake | Registers new rejection cases. |
| tests/compile_fail/best_search_result.cpp | Checks incompatible-result rejection. |
| tests/CMakeLists.txt | Registers result and ordering tests. |
| MIGRATION.md | Documents changed results and errors. |
| include/numerixx/roots/secant.hpp | Uses renamed evaluation counter. |
| include/numerixx/roots/search.hpp | Uses renamed evaluation counter. |
| include/numerixx/roots/newton.hpp | Updates fault accounting names. |
| include/numerixx/roots/bracket.hpp | Updates ordering and pole payloads. |
| include/numerixx/deriv/diff.hpp | Rejects non-finite inputs explicitly. |
| include/numerixx/core/steps.hpp | Shares checked stepping with driver. |
| include/numerixx/core/iterate.hpp | Adds ordering customization and error mapping. |
| include/numerixx/core/interval.hpp | Distinguishes invalid bracket inputs. |
| include/numerixx/core/facade.hpp | Extends missing-protocol diagnostics. |
| include/numerixx/core/error.hpp | Renames fields and adds result helpers. |
| include/numerixx/core/compose.hpp | Improves staged failures and chain layout. |
| include/numerixx/core/callable.hpp | Normalizes nested input faults. |
| examples/quick_tour.cpp | Corrects input-error explanation. |
| docs/redesign/PLAN.md | Records phase-1 progress. |
| CHANGELOG.md | Documents behavior changes and verification. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This is the first of three build PRs for phase 1. It builds steps (1)–(3) of the phase-1 row of DESIGN §10.3, as revised in §12.21: B7, B4 and B6. Built items carry a new status mark, [phase 1].
What
failure::where→byandfault::evals→evaluations. Newnxx::best(r)returns the solution's estimate or the failure's best as onestd::optional; a search result gets a reasoned deletion instead.best_xnames its remedy in a comment. Newdetail::is_result_v(canonical call 15).non_finite_input, and equal ends withinvalid_input.diffrejects a non-finite x. A nested Numerixx callable's input code becomesnon_finite_valueinsidenxx::evaluate(§12 item 22).checked_stepmaps an input code that a user-written step returns directly.nxx::better_thanis the order's customisation point;merit_ofandroots::better_thanare gone, and the protocol now requires an order. R3 ranks by width: half-widths only when both widths overflow, and a NaN |f| last. It is a strict weak order that never prefers a wider enclosure. Newsign_bracketprecondition. A pole failure carries its estimate without the enclosure.Decisions made during review. The maintainer made these on 2026-10-06. Each fixes a defect a reviewer reproduced.
evaluate. Before, an input code raised inprepareorinitwas bit-identical to the solver's own input rejection. A stop-on-inputfirst_of_withthen depended on the order of its alternatives.thenandwarm_fallbackhandle a stage-2 failure.non_finite_value.thenfailure keeps stage 1's estimate, except after a pole: rule 5 requires a failure to carry its best estimate.warm_fallbackno longer restarts an open method at a detected pole. It used to report the pole as a success at |f| = 5.8e14.nxx::optionsdifferently. Mixing their translation units in one program is documented as unsupported (DESIGN §5.3).Fixed: a pre-existing MSVC bug. On cl, a
first_ofnested in the first slot of anotherfirst_ofgot an overlapping layout, from two stacked[[msvc::no_unique_address]]members. The chain gave wrong results.first_of_t::policy_drops the attribute, and a regression test fails on cl without the fix.Verification
Reviews:
cpp-reviewer,numerics-reviewer,simplicity-reviewer,phase-scope-checkeranddocs-auditor, over four fix rounds. Every finding was reproduced before it was fixed, and each fix went back to the reviewer that found the problem. The final check found only doc corrections, which are applied.Tests fail without the fixes: when each fix is reverted, its new tests fail. For example, with the old order and pole payload 12 of the 21 order cases fail, and with the evaluate mapping removed 17 of 67 checks fail.
All 12 presets pass from a fresh configure, with no warnings, and the CI format check is clean:
The determinism golden table is unchanged.
Compiler floor: no new language or library feature in the library. The tests add
std::ranges::any_of, which is C++20 and inside the GCC 14 / Clang 19 floor. The nightly on master is green (a417eec, 2026-10-06), and the floor dispatch is planned after PR 3 (decision 7).Next
with_stopandboundsiblings, and A1.v2.0.0-alpha.1.🤖 Generated with Claude Code