Repository navigation
Decide a rational residual exactly, and decline a row a small part off (#2634, #2635) - #2637
Merged
Merged
Conversation
#2634, #2635) Two ways rounding that reached an exact system solve became a wrong answer. y^2 - 3 = 0, x^2 + (P - Q y) x - 1 = 0 at the 190th power of 2 + sqrt(3) was answered with false rows, x = -668385287/2 among them and y a rational within 1e-217 of sqrt(3). The quartic that #2612's second candidate leads to has coefficients near 1e217, and its roots came out rational. For any modest x, y = (x^2 + P x - 1)/(Q x) is within 1/Q^2 of sqrt(3). So the residual of y^2 - 3 is a nonzero rational near 1e-217, which reads as zero to the evaluation's digits and inside the enclosure's. A residual of rationals alone is now worked out exactly. x y = 1, x + y = 10^45 + 7 was answered with one of its two rows; 2.10.0 did the same. In the other row, y came out of the back-substitution as 10^45 exactly: downcasting put a value spoiled by a cancellation of 90 digits onto a nearby rational. The row left -7 against terms near 10^45, outside what IsEvidenceAgainst lets rounding leave, and was dropped as no solution. An exact residual that is not zero but is no more than a part in 10^12 of the largest term is now read as rounding having reached the row. A row a rewrite added leaves a residual of the terms' own size. Each case now gives all its rows or declines, through ResidualWeight .CannotTell. A sweep of 320 Pell-shape systems (d = 2, 3; powers 10 to 200; c = 1, 2, 3, 5; both signs), 48 sum-and-product, 148 product-of-lines, 12 circle and 18 Fibonacci-linear systems found 19 wrong answers on master and none here. The answered counts are unchanged and the 19 now decline. 270 checks of the determinant, rank and inverse of integer and rational matrices with entries near 1e30 to 1e60 agree exactly with fraction arithmetic, on master and here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2637 +/- ##
==========================================
+ Coverage 86.70% 86.72% +0.01%
==========================================
Files 345 345
Lines 75428 75558 +130
Branches 22034 22083 +49
==========================================
+ Hits 65397 65524 +127
+ Misses 5418 5412 -6
- Partials 4613 4622 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
I swept the system solver over scaled families whose complete answers are known, and found two ways that rounding inside an exact solve became a wrong answer.
#2634, false rows (introduced by #2612, unreleased).
y^2 - 3 = 0, x^2 + (P ∓ Q y) x - c = 0at(2 + sqrt(3))^190gave rows likex = -668385287/2, withya rational within1e-217ofsqrt(3); the Pell powers 150 and 200 forsqrt(2)failed the same way. The residual ofy^2 - 3is a nonzero rational that reads as 0 to every digit evaluated or enclosed. A residual made only of rationals is now decided exactly.#2635, a missing row (in 2.10.0 too). For
x y = 1, x + y = 10^45 + 7, downcasting rounded one row'syto10^45exactly. That row then left-7against terms near10^45and was dropped as no solution. An exact residual that is nonzero but at most1e-12of its largest term now reads as rounding having reached the row (ResidualWeight.CannotTell), and the system declines. A root added by a rewrite leaves a residual the size of its terms, so it is still dropped.Sweep (master
a3b3d25df→ this PR). Each case had to return all rows, matched against the complete solution set computed independently at 400 digits, or decline:x y = c, x + y = 10^e + 7, e up to 60, plain and scaledTests:
ARoundedRowIsDeclinedNotAnsweredTesthas 9 cases. On master, 6 fail: the 4 Pell cases and two sum-and-product cases. Two moderate-size controls stay answered. The full UnitTests suite (net10.0) passes: 21805 passed, 0 failed, 13 skipped. The library builds with 0 errors for every target framework. There is aBREAKING-CHANGES.mdentry for #2635; #2634 was never released.Closes #2634.
Closes #2635.
🤖 Generated with Claude Code