Skip to content

Commit 21e8262

Browse files
authored
fix empty intervals (#98)
1 parent 1e5e520 commit 21e8262

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/adapt.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ function handle_infinities(workfunc, f::InplaceIntegrand, s)
177177
end
178178

179179
function check_endpoint_roundoff(a, b, x; throw_error::Bool=false)
180+
throw_error && a == b && return false # don't throw on empty intervals
180181
c = convert(eltype(x), 0.5) * (b-a)
181182
(eval_at_a = a == a + (1+x[1])*c) && throw_error && throw_endpoint_error(a, a, b)
182183
(eval_at_b = b == a + (1-x[1])*c) && throw_error && throw_endpoint_error(b, a, b)

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ using QuadGK, LinearAlgebra, Test
2626

2727
# order=1 (issue #66)
2828
@test quadgk_count(x -> 1, 0, 1, order=1) == (1.0, 0.0, 3)
29+
30+
# empty intervals (issue #97)
31+
@test quadgk(x -> 1, 0,0) == quadgk(x -> 1, 0,0,0) == (0.0,0.0)
2932
end
3033

3134
module Test19626

0 commit comments

Comments
 (0)