|
567 | 567 | # rough implementation, needs multiple type handling
|
568 | 568 | # always ensures that if r = bisection(f, (x0, x1))
|
569 | 569 | # then either f(nextfloat(r)) == 0 or f(nextfloat(r)) * f(r) < 0
|
570 |
| -function bisection(f, tup, tdir; maxiters=100, noleft=false) |
| 570 | +function bisection(f, tup, tdir; maxiters=100) |
571 | 571 | x0, x1 = tup
|
572 | 572 | fx0x1 = f(x0) * f(x1)
|
573 | 573 | fzero = zero(fx0x1)
|
@@ -600,7 +600,7 @@ function bisection(f, tup, tdir; maxiters=100, noleft=false)
|
600 | 600 | end
|
601 | 601 | end
|
602 | 602 | end
|
603 |
| - (left === mid || right === mid) && return ((left === tup[1]) && noleft ? right : left) |
| 603 | + (left === mid || right === mid) && return left |
604 | 604 | if sign(y) === sign(f(left))
|
605 | 605 | left = mid
|
606 | 606 | else
|
@@ -650,7 +650,7 @@ function find_callback_time(integrator,callback::ContinuousCallback,counter)
|
650 | 650 | end
|
651 | 651 | iter == 12 && error("Double callback crossing floating pointer reducer errored. Report this issue.")
|
652 | 652 | end
|
653 |
| - Θ = bisection(zero_func, (bottom_t, top_t), integrator.tdir; noleft=(bottom_t==integrator.tprev)) |
| 653 | + Θ = bisection(zero_func, (bottom_t, top_t), integrator.tdir) |
654 | 654 | integrator.last_event_error = ODE_DEFAULT_NORM(zero_func(Θ), Θ)
|
655 | 655 | end
|
656 | 656 | #Θ = prevfloat(...)
|
@@ -717,7 +717,7 @@ function find_callback_time(integrator,callback::VectorContinuousCallback,counte
|
717 | 717 | end
|
718 | 718 | iter == 12 && error("Double callback crossing floating pointer reducer errored. Report this issue.")
|
719 | 719 | end
|
720 |
| - Θ = bisection(zero_func, (bottom_t,top_t), integrator.tdir; noleft=(bottom_t==integrator.tprev)) |
| 720 | + Θ = bisection(zero_func, (bottom_t,top_t), integrator.tdir) |
721 | 721 | if integrator.tdir * Θ < integrator.tdir * min_t
|
722 | 722 | integrator.last_event_error = ODE_DEFAULT_NORM(zero_func(Θ), Θ)
|
723 | 723 | end
|
|
0 commit comments