Skip to content

Read a vanishing absolute value as vanishing from above - #2364

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix/a-vanishing-absolute-value-is-positive
Nov 4, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix/a-vanishing-absolute-value-is-positive

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

1/abs(x) at 0 was NaN, which claims the limit does not exist. It is +oo, and 2.6.0 says NaN too.

The sign a vanishing divisor keeps was read off its derivatives. The derivative of abs(x) is sgn(x), 0 at 0, and there is nothing after it. So each side was left unevaluated, and the two descents not matching made the two-sided limit NaN.

An absolute value is now never negative by its form, and so is a real power, product or quotient of such things. A divisor of that kind vanishes from above, and a power of it to an exponent tending to a negative number tends to +oo.

Two sides that agree are promoted to the two-sided limit only for an expression shown real on both sides. That check knew nothing of an absolute value, a sine, a cosine, an arctangent or an arcsine, nor of a real power of something never negative. So sin(arcsin(x)) * (tan(-1) + 2/x), which is 2 from each side, was NaN, and sqrt(x^2)^(-3/2), which is +oo, was NaN too. Those are read now. Where the sides differ, as for x / abs(x), the limit is still NaN. The test pins five such cases, including the x^x convention.

One cost had to be paid back. Reading the sine and cosine as real makes tan(x/2) at pi real on both sides. Each time, it then asked its two sides in full again, though the descent had already answered them +oo and -oo. The one-sided path returns the descent's value first, so asking again can only give the same pair. The definite integral of 1/(2 + cos(x)) over [0, pi] ran out of its budget of limits on that. Both sides are now asked again only where one of them came back NaN.

limitcheck, DEPTH=3, seeds 14, 16, 19, 23, 26 and 29, against master 53ce725:

master this branch
compared 30 980 30 987
the limit is NaN where the values settle 79 75
the limit is another value 7 7

Every answer that changed is recorded in BREAKING-CHANGES.md. Suite, AOT and the harnesses are green locally.

Found by limitcheck at SEED=29; no issue was filed.

🤖 Generated with Claude Code

1/abs(x) at 0 was NaN -- the claim that the limit does not exist -- where it
is +oo. The sign a vanishing divisor keeps was read off its derivatives, and
the derivative of abs(x) is sgn(x), 0 at 0, with nothing after it, so each
side was left unevaluated and the two descents not matching made the
two-sided limit NaN. Same on 2.6.0. An absolute value, and a real power, a
product or a quotient of such things, is now never negative by its form: a
divisor of that kind vanishes from above, and a power of it to an exponent
tending to a negative number tends to +oo.

Two sides that agree were promoted to the two-sided limit only for an
expression shown real on both, which knew nothing of an absolute value, a
sine, a cosine, an arctangent or an arcsine, nor of a real power of
something never negative: sin(arcsin(x)) * (tan(-1) + 2/x) is 2 from each
side and was NaN, and sqrt(x^2)^(-3/2) +oo. Those are read now. That makes
tan(x/2) at pi real on both sides, and it asked its two sides in full again
each time, though the descent had answered them +oo and -oo -- the one-sided
path returns the descent's value first, so they differ again -- and the
definite integral of 1/(2 + cos(x)) over [0, pi] ran out of its budget of
limits. Both sides are asked again only where one came back NaN.

limitcheck, DEPTH=3, seeds 14, 16, 19, 23, 26, 29 against master 53ce725:
compared 30980 -> 30987, the limit is NaN where the values settle 79 -> 75,
the wrong values unchanged. Found at SEED=29; no issue was filed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 4, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.79%. Comparing base (53ce725) to head (76468fc).

Files with missing lines Patch % Lines
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 80.00% 2 Missing and 2 partials ⚠️
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 66.66% 0 Missing and 1 partial ⚠️
...ath/Functions/Continuous/Limits/Transformations.cs 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2364      +/-   ##
==========================================
- Coverage   86.79%   86.79%   -0.01%     
==========================================
  Files         312      312              
  Lines       68825    68855      +30     
  Branches    20053    20063      +10     
==========================================
+ Hits        59735    59761      +26     
- Misses       4907     4910       +3     
- Partials     4183     4184       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.33% <81.81%> (-0.01%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

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

Files with missing lines Coverage Δ
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 75.36% <66.66%> (+1.73%) ⬆️
...ath/Functions/Continuous/Limits/Transformations.cs 88.29% <90.00%> (+<0.01%) ⬆️
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 89.67% <80.00%> (-1.62%) ⬇️

... 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 f3e514a into master Nov 4, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 4, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the fix/a-vanishing-absolute-value-is-positive branch November 4, 2026 08:31
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