Error: Unexpected values in bisection. (DifferentialEquations)

I’m encountering an error related to using BigFloats and a callback that terminates the integrator upon certain conditions. More specifically, julia throws the following error when calling solve() with the callback on a problem whose initial condition is of type BigFloat:

Unexpected values in bisection. Please report the error in DiffEqBase.
in include_string at base/loading.jl:1088
in top-level scope at threebody.jl:160
in  at DiffEqBase/ypGPp/src/solve.jl:100
in #solve#460 at DiffEqBase/ypGPp/src/solve.jl:102 
in solve_up##kw at DiffEqBase/ypGPp/src/solve.jl:107 
in #solve_up#461 at DiffEqBase/ypGPp/src/solve.jl:114 
in solve_call##kw at DiffEqBase/ypGPp/src/solve.jl:65 
in #solve_call#457 at DiffEqBase/ypGPp/src/solve.jl:92
in  at OrdinaryDiffEq/VPJBD/src/solve.jl:4
in #__solve#391 at OrdinaryDiffEq/VPJBD/src/solve.jl:5
in solve! at OrdinaryDiffEq/VPJBD/src/solve.jl:429
in loopfooter! at OrdinaryDiffEq/VPJBD/src/integrators/integrator_utils.jl:166 
in _loopfooter! at OrdinaryDiffEq/VPJBD/src/integrators/integrator_utils.jl:202
in handle_callbacks! at OrdinaryDiffEq/VPJBD/src/integrators/integrator_utils.jl:247
in find_first_continuous_callback at DiffEqBase/ypGPp/src/callbacks.jl:398 
in find_callback_time at DiffEqBase/ypGPp/src/callbacks.jl:730
in bisection at DiffEqBase/ypGPp/src/callbacks.jl:581 
in #bisection#410 at DiffEqBase/ypGPp/src/callbacks.jl:592
in error at base/error.jl:33

The integration succeeds when no callback is specified. The callback also performs as expected when the initial condition is Float64. The callback I am using is

import LinearAlgebra.norm

function condition(out,u,t,integrator)
  out[1] = norm(u[1:2])-Rsys
  out[2] = R1-norm(u[1:2]-P1) 
  out[3] = R2-norm(u[1:2]-P2) 
end

function affect!(integrator, event_index)
  terminate!(integrator)
end

My purposes necessitate higher precision than Float64, so I’d like to find a solution if possible. From the error message, I think the problem lies in detecting the zero crossing at high precision. Does this seem correct?

Could you open an issue on DifferentialEquations.jl with enough code that we can run it? We’ll need to dig into this one.

1 Like

Will do, thanks.

Edit: Done.

1 Like

I’ve noticed that a DiscreteCallback works fine. The issue seems endemic to ContinuousCallbacks.