Skip to content

Leave a two-sided limit undecided where a side stops at a finite form beside real values - #2426

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/a-finite-indeterminate-side-near-real-values-is-undecided
Nov 13, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/a-finite-indeterminate-side-near-real-values-is-undecided

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

When the descent's sides come back NaN, a two-sided limit asks each side outright. Since #2419, a side that stops at an indeterminate form with an infinity in it is undecided. A side that stops at a form of finite parts only, 0 / 0 or c / 0, still counted as a side with no limit, which made the two-sided limit NaN.

That is right for (x - x) / (x - x), which has no value anywhere. It is wrong for erf(abs(x)) / x^4 at 0: that limit is +oo from each side, and the form only shows that two rates were never compared.

Such a side now counts as undecided where the expression has a finite real value at 10^-6 and 10^-9 from the point on that side. Where it has no real value there, the side still has no limit. That covers (x - x) / (x - x), and ln(-2) / ln(x) at 1, which is complex beside the point.

Input, at 0, two-sided true value 2.6.0 master this branch
erf(abs(x)) / x^4 +oo unevaluated NaN unevaluated
erf(abs(x)) / (x^3 * sinh(x)) +oo unevaluated NaN unevaluated
1 / log(x^2, cos(x)) +oo -oo NaN unevaluated
abs(x)^erf(x) 1 unevaluated NaN unevaluated
tan(1/2 + x) + abs(x)^erf(x) tan(1/2) + 1 unevaluated NaN unevaluated
1 / (x * arccot(x)) +oo NaN NaN unevaluated
(x - x) / (x - x) none NaN NaN NaN
(x - x) * sin(x) / ((x - x) * x) none NaN NaN NaN
ln(-2) / ln(x), at 1 none NaN NaN NaN
sin(1/x), floor(2/x), floor(x), 1/x, abs(x)/x none NaN NaN NaN

Against 2.6.0, the 1 / log(x^2, cos(x)) and 1 / (x * arccot(x)) rows change, and both are in BREAKING-CHANGES.md. The other wrong NaNs appeared during this cycle and never shipped. The test pins all of them as unevaluated, and the cases with no limit as NaN.

The check runs only on the path where a side has already stopped at an indeterminate form, so no limit that was already answered pays for it.

Checked on this branch:

  • Tests: UnitTests 19355 passed, plus the MCP, Terminal, InteractiveWrapper and F# wrapper suites, and the AOT smoke test. A 1 / (x * arccot(x)) test row and its BREAKING-CHANGES.md row were added after that run; the test passes.
  • Harnesses: BoundCheck, RootCheck, CasBench, PropCheck, SimpSweep, RuleCheck, CanonCheck and Confluence all pass.
  • limitcheck at DEPTH=3, COUNT=600, on 42 seeds against master: seven rows went from NaN to unevaluated, and no row gained a value. Each is an expression that is real beside the point through a complex intermediate.
    • abs(arctan(x^x)) at 0 is pi/4 from each side, and abs(sinh(2)^log(x, -1)) at 1 is 1 from each side, so their NaN was wrong.
    • cos(sinh(log(x, -1))) at 1 oscillates, so it had no limit and NaN was right; unevaluated is not wrong.
    • x^x at 0 itself is not real to the left and stays NaN, as LimitTest.TestNoLimit pins it.

🤖 Generated with Claude Code

… beside real values

A two-sided limit asks each side outright when the descent's sides come back
NaN. A side that stops at an indeterminate form with an infinity in it counts
as undecided (#2419); one of finite parts, 0 / 0 or c / 0, counted as a side
without a limit, which made the two-sided limit NaN. That is right for
(x - x) / (x - x), which has no value anywhere, and wrong for
erf(abs(x)) / x^4 at 0, which is +oo from each side: the form there is two
parts whose rates were never compared.

Such a side now counts as undecided where the expression has a finite real
value at 10^-6 and 10^-9 from the point on that side. Where it has none --
(x - x) / (x - x), or ln(-2) / ln(x) at 1, complex beside the point -- the
side still has no limit and the two-sided limit stays NaN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.80%. Comparing base (fe19c27) to head (1785c0e).

Files with missing lines Patch % Lines
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2426      +/-   ##
==========================================
- Coverage   86.82%   86.80%   -0.03%     
==========================================
  Files         312      312              
  Lines       69545    69551       +6     
  Branches    20312    20316       +4     
==========================================
- Hits        60380    60371       -9     
- Misses       4929     4944      +15     
  Partials     4236     4236              
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.34% <77.77%> (-0.03%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 39.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 92.10% <77.77%> (-0.52%) ⬇️

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit 2eea2e9 into master Nov 13, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 13, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/a-finite-indeterminate-side-near-real-values-is-undecided branch November 13, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant