Repository navigation
Read the side a step function's argument arrives from off its slope - #2375
Merged
Merged
Conversation
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>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
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, sofloor(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. Forsqrt(x)the slope is1 / 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)timese ^ (i pi tanh(pi)), and the first version of this change answered its sign as -1. The test for realness isIsRealValued, orWhereRealValued's condition holding near the destination. The real domain condition can't be used for this, because forx ^ tanh(pi)it isTrue.floor(sqrt(x))at 0, right0ceil(sqrt(x))at 0, right1floor(x - sqrt(x))at 0, right-1floor(1 - sqrt(1 - x))at 1, left0floor(sqrt(x)) - (x^3)^(x/2)at 0, rightNaN-1Left 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:
ASignFromTheSlopeTesthas 11 cases. The 9 answering cases fail on master, and the two cases that must decline pass on both.Measured:
DEPTH=3over 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 handle0 * oo.Found by limitcheck at
SEED=59. No issue was filed.🤖 Generated with Claude Code