Skip to content

Commit e3c1d31

Browse files
authored
Merge pull request #459 from lucaferranti/lf/irrational_dotdot
fix `..` for irrational inputs
2 parents 24a0b66 + 993623e commit e3c1d31

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/intervals/intervals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ end
151151

152152
function ..(a::Irrational{T}, b::S) where {T, S}
153153
R = promote_type(Irrational{T}, S)
154-
return Interval(R(a, RoundDown), atomic(Interval{R}, b).hi)
154+
return interval(R(a, RoundDown), atomic(Interval{R}, b).hi)
155155
end
156156

157157
function ..(a::Irrational{T}, b::Irrational{S}) where {T, S}
158158
R = promote_type(Irrational{T}, Irrational{S})
159-
return Interval(a, b)
159+
return interval(a, b)
160160
end
161161

162162
# ..(a::Integer, b::Integer) = interval(a, b)

test/interval_tests/construction.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ end
236236

237237
a = big(0.1)..2
238238
@test typeof(a) == Interval{BigFloat}
239+
240+
@test_throws ArgumentError 2..1
241+
@test_throws ArgumentError π..1
242+
@test_throws ArgumentError π..eeuler
243+
@test_throws ArgumentError 4..π
244+
@test 1..π == Interval(1, π)
239245
end
240246

241247
@testset "± tests" begin

0 commit comments

Comments
 (0)