Repository navigation
Conversation
Steps (4)-(6) of the phase-1 row of DESIGN §10.3, as revised in §12.21:
- B1, criteria (§6.2, §6.8): width_tol and x_tol take
width_tol{abs, nxx::rel_tolerance{rel}}; the bare two-number form
and a part alone are deleted with reasons; the make set is make(a),
make(a, *rel) (the run-time mirror of the literal, two checks) and
make(abs_tolerance, rel_tolerance), with make(T, T) deleted and its
text naming make(a, *rel). Every two-number spelling is migrated;
canonical calls 13 and 14.
- B1, solvers (§7.2): brent, bisection, secant and newton reject a
validated tolerance or a part through their existing bare-number
deletion (one trait, not_a_criterion_v), with decision 12's remedy.
- with_stop (§6.6): one sibling for anything that is not a criterion,
whose text says that only width_tol bounds the error in x; this also
fixes the false reason with_stop(1e-10) used to get. bound's call
operator gains its reason.
- A1 (§3.5): the defaults are achievable, read from the solvers' own
defaults, by static_assert for float, double and long double and at
run time for cpp_bin_float_50.
Decided during review (§12 item 24): a validated tolerance takes a
relative part, width_tol{*tol, *rel} (a constexpr constructor, make and
guide), because DESIGN tells configurations to hold a tolerance<T> and
that spelling failed with a 106-line CTAD error; a mixed-type literal
narrows the absolute part, which is documented.
Reviewed by cpp-, numerics-, simplicity-, phase-scope- and
docs-reviewers with one fix round and a re-check. All 12 presets pass
from a fresh configure (333 tests; 331 on msvc, 348 with
multiprecision, 8 on integration); the golden table's values are
unchanged. Source: Numerixx 1.x v1.1.0-legacy and v1.0.0 for the
MIGRATION citations only; no external code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Compiler-sensitive deduction and diagnostic changes still need human confirmation on the supported compiler floor.
0 open findings
What changed in this PR
Implements phase-1 steps 4–6: role-typed tolerances, clearer misuse diagnostics, and checks that solver defaults remain achievable.
Changes:
- Requires named relative tolerances and supports validated tolerance pairs.
- Improves solver,
with_stop, and bound-call diagnostics. - Expands contract tests, default checks, examples, and migration guidance.
| File | Description |
|---|---|
| tests/usage/canonical_calls.cpp | Adds mixed and run-time tolerance examples. |
| tests/structural/consumer_warnings.cpp | Migrates tolerance spellings. |
| tests/roots/test_soundness.cpp | Migrates tolerance construction. |
| tests/roots/test_solvers.cpp | Tests defaults, rejections, and remedies. |
| tests/roots/test_determinism.cpp | Migrates literals; preserves golden values. |
| tests/multiprecision/test_multiprecision.cpp | Tests multiprecision defaults and tolerances. |
| tests/core/test_refined.cpp | Tests role-typed construction and validation. |
| tests/core/test_criteria.cpp | Migrates criterion literals. |
| tests/compile_fail/x_tol_zero_zero.cpp | Updates invalid joint-tolerance case. |
| tests/compile_fail/x_tol_two_numbers.cpp | Checks bare-number rejection. |
| tests/compile_fail/x_tol_abs_part_alone.cpp | Checks absolute-part rejection. |
| tests/compile_fail/width_tol_zero_zero.cpp | Checks joint invariant rejection. |
| tests/compile_fail/width_tol_two_numbers.cpp | Checks bare-number rejection. |
| tests/compile_fail/width_tol_runtime_parts.cpp | Checks run-time literal rejection. |
| tests/compile_fail/width_tol_relative_alone.cpp | Checks relative-part rejection. |
| tests/compile_fail/width_tol_negative_abs_literal.cpp | Checks negative absolute rejection. |
| tests/compile_fail/width_tol_make_two_numbers.cpp | Checks positional factory rejection. |
| tests/compile_fail/rel_tolerance_as_tolerance.cpp | Clarifies diagnostic comment. |
| tests/compile_fail/probe_p2564_escalation.cpp | Extends mixed-constructor portability probe. |
| tests/compile_fail/compile_fail.cmake | Registers cases and diagnostic expectations. |
| tests/compile_fail/brent_with_stop_width.cpp | Updates tolerance spelling in comment. |
| tests/compile_fail/brent_validated_tolerance.cpp | Checks Brent tolerance diagnostic. |
| tests/compile_fail/bound_wrong_function.cpp | Checks bound-call diagnostic. |
| tests/compile_fail/bisection_with_stop_tolerance.cpp | Checks non-criterion diagnostic. |
| tests/compile_fail/bisection_validated_tolerance.cpp | Checks bisection tolerance diagnostic. |
| MIGRATION.md | Explains legacy tolerance migration. |
| include/numerixx/roots/secant.hpp | Extends tolerance misuse diagnostics. |
| include/numerixx/roots/newton.hpp | Extends tolerance misuse diagnostics. |
| include/numerixx/roots/brent.hpp | Updates diagnostics and deduction guide. |
| include/numerixx/roots/bisection.hpp | Extends tolerance misuse diagnostics. |
| include/numerixx/core/refined.hpp | Centralizes tolerance classification traits. |
| include/numerixx/core/facade.hpp | Adds non-criterion and bound-call reasons. |
| include/numerixx/core/criteria.hpp | Implements role-typed tolerance construction. |
| examples/quick_tour.cpp | Demonstrates updated tolerance API. |
| docs/redesign/PLAN.md | Updates phase-1 progress. |
| docs/redesign/DESIGN.md | Records contracts, decisions, and verification. |
| CHANGELOG.md | Records API changes and tests. |
🧠 Review effort: Balanced
💡 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 second of three build PRs for phase 1. It builds steps (4)–(6) of the phase-1 row of DESIGN §10.3, as revised in §12.21.
What
width_tol{abs, nxx::rel_tolerance{rel}}and the same forx_tol. The bare two-number form, a part alone, andmake(T, T)are deleted with reasons. Themakeset ismake(a),make(a, *rel)(two checks, the run-time mirror of the literal) andmake(abs_tolerance, rel_tolerance). Every two-number spelling is migrated. Adds canonical calls 13 and 14.brent,bisection,secantandnewtonreject a validated tolerance or a part through their existing bare-number deletion, which now uses one trait,not_a_criterion_v. No new deletions; the texts gain decision 12's remedy.with_stopgets one sibling for anything that is not a criterion. Its text says that onlywidth_tolbounds the error in x,x_tolonly the last step andf_tolonly |f(x)|. This also fixes today's false reason forwith_stop(1e-10).bound::operator()gains its reason.static_assertfor float, double and long double, and at run time forcpp_bin_float_50. The check fails when a default is made unachievable, and also when the 4·eps floor is removed.Decided during review. The maintainer made these on 2026-10-07; DESIGN §12 item 24 records them.
width_tol{*tol, *rel}and itsx_toltwin are accepted, as a constexpr constructor plusmakeand a guide. DESIGN tells configurations to hold atolerance<T>, yet adding a relative part to one failed with a 106-line CTAD error.make(T, T)reason namesmake(a, *rel).Verification
Reviews:
cpp-reviewer,numerics-reviewer,simplicity-reviewer,phase-scope-checkeranddocs-auditor, with one fix round. Then a re-check, whose last two small findings I applied.makeform on GCC 16.1, Clang 22.1.8, cl 19.51 and clang-cl 22.1.3. There is no ambiguity, every misuse leavesis_invocable/is_constructiblefalse rather than a hard error, and cl reports C2280 (the deleted declaration) rather than C2668 (an ambiguity).All 12 presets pass from a fresh configure, with no warnings, and the CI format check is clean:
The golden table's values are unchanged; only four literals changed spelling.
Compiler floor: no new language or library feature in the library. The tests use
std::expected::and_then, which is within the GCC 14 / Clang 19 / libstdc++ 14.3 floor. Two first-error formats are not yet seen on GCC 14 and Clang 19: Clang 19's implicit guide reaching bisection's widened deletion (the same path as today's bare-number case, which the nightly passes), and two new compile-fail cases withoutDELETE_REASON. The scheduled nightly will check them after merge, and the floor dispatch is planned after PR 3. The nightly on master is green (de3fca1, 2026-10-07).Next
PR 3, callbacks and combinators: B2/B3, B5 and A2. Then the nightly dispatch (asking first) and the tag
v2.0.0-alpha.1.🤖 Generated with Claude Code