Skip to content

Commit e8b45c8

Browse files
JilhgJilhg
andauthored
Fix for issue #125 for real numbers (#126)
* Overload indomain for PeriodicSegment * indomain is only true if real number isfinite --------- Co-authored-by: Jilhg <jilhg@github.com>
1 parent 011e11a commit e8b45c8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Domains/PeriodicSegment.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ reverseorientation(d::PeriodicSegment) = PeriodicSegment(rightendpoint(d), lefte
7272
==(d::PeriodicSegment,m::PeriodicSegment) = leftendpoint(d) == m.a && rightendpoint(d) == m.b
7373

7474

75-
76-
77-
7875
## algebra
7976

8077
for op in (:*,:+,:-)
@@ -105,6 +102,7 @@ function convert(::Type{PeriodicDomain},d::ClosedInterval)
105102
end
106103
end
107104

105+
indomain(x::R1, d::PeriodicSegment{R2}) where {R1<:Real,R2<:Real} = isfinite(x)
108106
issubset(a::PeriodicSegment, b::IntervalOrSegment) = Segment(endpoints(a)...)b
109107
issubset(a::IntervalOrSegment, b::PeriodicSegment) = PeriodicSegment(endpoints(a)...)b
110108

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ end
2727
@test 0.1 PeriodicSegment(2π,0)
2828
@test 100.0 PeriodicSegment(0,2π)
2929
@test -100.0 PeriodicSegment(0,2π)
30+
@test 0 PeriodicSegment(-2,3) #issue 125
31+
@test 1e-15 PeriodicSegment(-2,3) #issue 125
3032

31-
@test 10.0 PeriodicLine()
33+
@test 10.0 PeriodicLine()
3234
@test -10.0 PeriodicLine()
3335
@test -10.0+im PeriodicLine()
36+
@test 0 PeriodicLine() #issue 125
37+
@test 1e-15 PeriodicLine() #issue 125
3438

3539
p = PeriodicSegment(0,2π)
3640
@test leftendpoint(p) == 0

0 commit comments

Comments
 (0)