Skip to content

Commit b243184

Browse files
Damien Courtevilledcourteville
authored andcommitted
Ensure internal ITP bounds are in proper order
1 parent 100f97b commit b243184

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/internal_itp.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
3030
args...;
3131
maxiters = 1000, kwargs...) where {IP, T}
3232
f = Base.Fix2(prob.f, prob.p)
33-
left, right = prob.tspan # a and b
33+
left, right = minmax(prob.tspan...) # a and b
3434
fl, fr = f(left), f(right)
3535
ϵ = eps(T)
3636
if iszero(fl)
@@ -40,7 +40,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
4040
return SciMLBase.build_solution(prob, alg, right, fr;
4141
retcode = ReturnCode.ExactSolutionRight, left, right)
4242
end
43-
span = abs(right - left)
43+
span = right - left
4444
k1 = T(alg.scaled_k1) / span
4545
n0 = T(alg.n0)
4646
n_h = exponent(span / (2 * ϵ))
@@ -49,7 +49,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
4949

5050
i = 1
5151
while i maxiters
52-
span = abs(right - left)
52+
span = right - left
5353
mid = (left + right) / 2
5454
r = ϵ_s - (span / 2)
5555

0 commit comments

Comments
 (0)