Repository navigation
Conversation
Closed
m-messer
added this pull request to stack #291
October 20, 2026 13:09
m-messer
force-pushed
the
fix/tolerance-alignment
branch
from
October 20, 2026 14:14
2b9c77d to
729dd96
Compare
m-messer
removed this pull request from stack #291
October 20, 2026 14:19
m-messer
force-pushed
the
fix/criteria-correctness
branch
from
October 23, 2026 09:43
b9fb345 to
c39aeb3
Compare
m-messer
force-pushed
the
fix/tolerance-alignment
branch
from
October 23, 2026 09:43
729dd96 to
1bf6443
Compare
…ute tolerance checks; refactor evaluation logic and expand test coverage
m-messer
force-pushed
the
fix/criteria-correctness
branch
from
October 23, 2026 12:44
c39aeb3 to
64872a9
Compare
m-messer
force-pushed
the
fix/tolerance-alignment
branch
from
October 23, 2026 12:44
1bf6443 to
0ad04ad
Compare
This branch has not been deployed
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.
Problem
The symbolic and physical-quantity contexts each had their own rtol/atol check, and they disagreed (bug report, bug 9). This PR is stacked on #286 and replaces #262 (
fix/atol-rtol-alignment), which made the same change on the code from before the refactor.compare_numerically)_within_tolerance)<<Changes
The agreed rules are the same as
numpy.isclose, and they are what #262 proposed:|ans - res| <= atol + rtol*|ans|.values_within_tolerance(newapp/context/tolerance.py):(ans - res)/ans(e.g. both sides are multiples ofrho*L**3), it checks rtol alone, because atol needs a numerical value of the answer;Falsewhen the values can't be compared numerically.compare_numerically(app/context/symbolic/numerical.py) and_within_tolerance(app/context/physical_quantity/graphs/match.py) both call it.app/docs/user.md: the tolerance descriptions now say≤and explain how rtol and atol combine. Also fixes some broken LaTeX in theabsolute_toleranceentry.Behaviour changes (answer
1unless noted):rho*L**3, response1.05*rho*L**3, rtol 0.1, atol 0.01A physical quantity whose tolerance comes from the answer's significant figures also accepts a value exactly at the boundary now (
1 maccepts1.5 m).Checklist
Testing
test_numerical_tolerancesinsymbolic_evaluation_test.pyand inphysical_quantity_evaluation_test.py. The five cases that change behaviour failed before the fix.test_values_within_tolerancecalls the helper directly, including zero, complex and symbolic values.pytest app: 1290 passed, 2 skipped, 1 failed. The failure istest_radians_to_frequency, which already failed before this PR.mypy app: no issues.With #284, #286, #288 and this PR, every bug in the report has a fix.
🤖 Generated with Claude Code