Skip to content

Read a tangent, an error function and a step function as real when a limit's sides are compared - #2418

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/real-functions-agree-on-both-sides-in-a-limit
Nov 13, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/real-functions-agree-on-both-sides-in-a-limit

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A two-sided limit at a finite point compares the limits from each side. When a side's descent comes back NaN, the comparison asks each side outright. Outside a real codomain, it does that only if the expression is real on both sides of the point, which is decided by reading its structure. That reading knew the sine, the cosine, the arctangent, the arcsine and the arccosine. Anything else counted as not real, so the two-sided limit was NaN even where both sides agree.

This adds the tangent, the arccotangent, erf, erfc, erfi, floor, ceil, round and sgn, each real when its argument is real.

Input, at 0, two-sided 2.6.0 master this branch
(pi^2 + (1/2) / x) * erf(x) unevaluated NaN 1 / sqrt(pi)
(1 + 1/x) * erf(x) unevaluated NaN 2 * 1 / sqrt(pi)
(abs(x)^(x/pi))^sgn(x) unevaluated NaN 1
floor(x) unevaluated NaN NaN
sgn(x) unevaluated NaN NaN
erfc(x) / x NaN NaN NaN
x * sgn(x) 0 0 0
tan(x) / x 1 1 1
sgn(x) / x unevaluated +oo +oo

The first three rows are in BREAKING-CHANGES.md. The new test pins them by value, and pins floor(x), sgn(x) and erfc(x) / x as NaN, since their sides differ.

Not in this PR: x * floor(2/x) at 0 two-sided is NaN on master and on this branch, while each side is 2. The sides there are undecided, not different, and that is a separate change.

Checked on this branch:

  • Tests: UnitTests 19320 passed (the seed-43 case was added to the test after that run and passes alone), plus the MCP, Terminal, InteractiveWrapper and F# wrapper suites, and the AOT smoke test.
  • Harnesses: BoundCheck, RootCheck, CasBench, PropCheck, SimpSweep, RuleCheck, CanonCheck and Confluence all pass.
  • limitcheck at DEPTH=3, COUNT=600, on 42 seeds against master: one row changed, the (abs(x)^(x/pi))^sgn(x) row above (seed 43). Seed 45's tanh(log(x, -1) - tan(x)) from the left also moved into "did not finish in 5 s", but that limit takes 5.7 s on master as well as on this branch, so the 5 s cap decides it. That limit is unevaluated on both. Seed 237 of a wider sweep found the case.

🤖 Generated with Claude Code

…limit's sides are compared

A two-sided limit compares its sides where the expression is real on
both, and the structural reading of that knew a sine, a cosine and an
arctangent but not a tangent, an arccotangent, the error functions or
the step functions, all real for a real argument. Where the descent
read a side as 0 * oo the limit was NaN, which says it does not exist:
(pi^2 + 1/(2x)) erf(x) at 0 is 1/sqrt(pi) from each side.

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

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.81%. Comparing base (f17be26) to head (d690f70).

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2418      +/-   ##
==========================================
+ Coverage   86.80%   86.81%   +0.01%     
==========================================
  Files         312      312              
  Lines       69503    69514      +11     
  Branches    20300    20300              
==========================================
+ Hits        60329    60347      +18     
+ Misses       4940     4934       -6     
+ Partials     4234     4233       -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.35% <63.63%> (+0.01%) ⬆️
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 91.69% <63.63%> (-1.12%) ⬇️

... and 6 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 15070c6 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/real-functions-agree-on-both-sides-in-a-limit branch November 13, 2026 08:40
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