Skip to content

Read the side a step function's argument arrives from off its slope - #2375

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/a-sign-from-the-slope
Nov 5, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/a-sign-from-the-slope

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A floor or a ceiling whose argument arrives at a jump asks which side of the jump the argument comes from. That side was read only from the first derivative that is not zero. sqrt(x) at 0 has none that is finite, so floor(sqrt(x)) at 0 from the right was not answered, though it is 0 all the way in.

When the derivative test gives no answer, the side is now also read from the slope g(x) / (x - a). If the slope tends to a non-zero L, infinities included, then g has the sign of L on the right and the opposite sign on the left. For sqrt(x) the slope is 1 / sqrt(x), which tends to +oo.

This only applies where the expression is real throughout the side approached. A complex value's slope can still tend to a real infinity. On the left of 0, x ^ tanh(pi) is |x| ^ tanh(pi) times e ^ (i pi tanh(pi)), and the first version of this change answered its sign as -1. The test for realness is IsRealValued, or WhereRealValued's condition holding near the destination. The real domain condition can't be used for this, because for x ^ tanh(pi) it is True.

Limit 2.6.0 Now
floor(sqrt(x)) at 0, right unevaluated 0
ceil(sqrt(x)) at 0, right unevaluated 1
floor(x - sqrt(x)) at 0, right unevaluated -1
floor(1 - sqrt(1 - x)) at 1, left unevaluated 0
floor(sqrt(x)) - (x^3)^(x/2) at 0, right NaN -1

Left unanswered:

  • sgn(x ^ tanh(pi)) at 0 from the left.
  • floor(sqrt(x)) at 0 from the left.
  • floor(cbrt(x)) at 0 from the left. With downcasting off, a cube root of a negative is the principal one, so it is not real there.

The entry is in BREAKING-CHANGES.md.

Tests: ASignFromTheSlopeTest has 11 cases. The 9 answering cases fail on master, and the two cases that must decline pass on both.

Measured:

  • The unit, MCP, terminal, interactive and F# suites pass.
  • AOT builds.
  • The boundcheck, rootcheck, casbench, propcheck, simpsweep, rulecheck, canoncheck and confluence harnesses all pass.
  • limitcheck at DEPTH=3 over 30 seeds, against master: no case lost. There is one timeout fewer, which is noise: that case takes about 6 s either way.

Not fixed: floor(x * ln(x)) at 0 from the right. The floor asks for its argument's limit through a path that does not handle 0 * oo.

Found by limitcheck at SEED=59. No issue was filed.

🤖 Generated with Claude Code

A floor or a ceiling whose argument arrives at a jump asks the sign the
argument less the jump keeps on the way in, and that sign was read only
off the first derivative that does not vanish. sqrt(x) at 0 has none
that is finite, so floor(sqrt(x)) at 0 from the right was not answered,
where it is 0 all the way in.

Where that fails, the sign is now also read off the slope
g(x) / (x - a): where it tends to a non-zero L, infinities included, g
has the sign of L on the right and the other on the left. For sqrt(x)
the slope is 1 / sqrt(x), which tends to +oo. A sign is a question
about a real value, and the slope of a complex one can tend to a real
infinity: x ^ tanh(pi) on the left of 0 is |x| ^ tanh(pi) times
e ^ (i pi tanh(pi)), which this read as negative. So the expression has
to be real throughout the side approached, by IsRealValued or by
WhereRealValued's condition holding there; its real domain condition is
no test, as that of x ^ tanh(pi) is true.

limitcheck at DEPTH=3 over 30 seeds against master: no case lost; one
timeout fewer, which is within the noise of a case that takes about
6 s on either. Found by limitcheck at SEED=59, where
floor(sqrt(x)) - (x^3)^(x/2) at 0 from the right is -1; 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 5, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 5, 2026
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.76%. Comparing base (595d9b6) to head (73bf581).

Files with missing lines Patch % Lines
...ath/Functions/Continuous/Limits/Transformations.cs 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2375      +/-   ##
==========================================
- Coverage   86.77%   86.76%   -0.01%     
==========================================
  Files         312      312              
  Lines       68979    68987       +8     
  Branches    20107    20112       +5     
==========================================
+ Hits        59854    59857       +3     
- Misses       4920     4923       +3     
- Partials     4205     4207       +2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.30% <88.88%> (-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 Δ
...ath/Functions/Continuous/Limits/Transformations.cs 88.52% <88.88%> (+0.14%) ⬆️

... and 4 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 60e6638 into master Nov 5, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 5, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/a-sign-from-the-slope branch November 5, 2026 23:39
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