Skip to content

A difference of two intervals keeps the parts on either side - #2300

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-difference-of-intervals-keeps-both-pieces
Oct 31, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-difference-of-intervals-keeps-both-pieces

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A \ B for two intervals is the part of A below B and the part above it, each holding the end of B that B does not.

master and 2.6.0 now
[0; 10] \ (2; 3) [0; 3] [0; 2] \/ [3; 10]
[0; 10] \ [-1; 3) (3; 10] [3; 10]
[0; 10] \ (0; 3) [3; 10] { 0 } \/ [3; 10]
[0; 10] \ (0; 10) [0; 10] { 0, 10 }
(-oo; +oo) \ [0; 1) (-oo; 1) (-oo; 0) \/ [1; +oo)
[0; sqrt(2)] \ [1; 2] left as written [0; 1)
(a; b) \ [a; b] (a; b) { }
[a; b] \ (a; b) [a; b] left as written: it is { a, b } where a < b and nothing where a > b
5 in ([0; 10] \ (2; 3)) False True
  • The ends are compared by their values, as IntersectIntervalAndInterval compares them, and kept as written.
  • IntervalAndInterval checks membership at nine points for every order of four ends from 0 to 3, with each end open or closed: 4,096 pairs. 19 of the new tests fail on master.
  • The suite, the trio, F#, AOT and the eight harnesses pass.

Fixes #2290.

🤖 Generated with Claude Code

A \ B for two intervals is now the part of A below B and the part
above it, each an interval, a point or nothing, and each holding the
end of B that B does not. The last three returns of
SetSubtractIntervalAndInterval answered one interval from an end of A
to the far end of B where B lay inside A, so [0; 10] \ (2; 3) was
[0; 3]. Where B covered an end of A, they read the end of the cut from
B's other end, so [0; 10] \ [-1; 3) was (3; 10]. And an end of A that B
left was folded into a flag, so [0; 10] \ (0; 3) lost the point 0.
Membership followed: 5 in ([0; 10] \ (2; 3)) was False.

The ends are compared by their values, as the intersection compares
them, and kept as written, so [0; sqrt(2)] \ [1; 2] is [0; 1) where it
was left as written. Ends with no value decide only when they are the
same and B holds every end A holds: (a; b) \ [a; b] is empty, where it
was (a; b). [a; b] \ (a; b) is { a, b } where a < b and nothing where
a > b, so it is left as written, where it was [a; b].

IntervalAndInterval checks the issue's table and a few more, and that
the difference holds a point exactly where A does and B does not, over
every order of four ends from 0 to 3 with each end open or closed, 4096
pairs at nine points each. Nineteen of the new tests fail on master.
2.6.0 answers as master does. The suite, the trio, F#, AOT and the eight
harnesses pass.

Fixes #2290.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 31, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 31, 2026
@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.76%. Comparing base (c633c41) to head (9b5b9cb).

Files with missing lines Patch % Lines
...re/Entity/Omni/Sets/SetOperators.SetSubtraction.cs 93.10% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2300      +/-   ##
==========================================
+ Coverage   86.74%   86.76%   +0.02%     
==========================================
  Files         310      310              
  Lines       67973    67974       +1     
  Branches    19744    19736       -8     
==========================================
+ Hits        58961    58979      +18     
+ Misses       4880     4872       -8     
+ Partials     4132     4123       -9     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.31% <93.10%> (+0.02%) ⬆️
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 Δ
...re/Entity/Omni/Sets/SetOperators.SetSubtraction.cs 90.90% <93.10%> (+39.74%) ⬆️

... and 1 file 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 0aceeb5 into master Oct 31, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 31, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-difference-of-intervals-keeps-both-pieces branch October 31, 2026 19:08
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.

A difference of two intervals has the wrong ends, and loses a piece when the second lies inside the first

1 participant