File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
lib/BracketingNonlinearSolve Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,13 @@ function SciMLBase.__solve(
9696 span = right - left
9797 k1 = alg. scaled_k1 * span^ (1 - k2) # k1 > 0
9898 n0 = alg. n0
99- n_h = exponent (span / (2 * ϵ))
100- ϵ_s = ϵ * exp2 (n_h + n0)
99+ if span / 2 > ϵ * floatmax (typeof (span))
100+ # Workaround for when span / (2 * ϵ) == Inf
101+ ϵ_s = span / 2 * exp2 (n0)
102+ else
103+ n_h = exponent (span / (2 * ϵ))
104+ ϵ_s = ϵ * exp2 (n_h) * exp2 (n0)
105+ end
101106 T0 = zero (fl)
102107
103108 i = 1
Original file line number Diff line number Diff line change 7474 @test result_tol > ϵ
7575 end
7676 end
77+
78+ # Some solvers support abstol=0.0 and converge to floating point precision
79+ @testset for alg in (Bisection (), ITP (), Brent ())
80+ sol = solve (prob, alg; abstol = 0.0 )
81+ # Test that solution is to floating point precision
82+ @test sol. retcode == ReturnCode. FloatingPointLimit
83+ @test quadratic_f (sol. left, 2.0 ) < 0
84+ @test quadratic_f (sol. right, 2.0 ) > 0
85+ @test nextfloat (sol. left) == sol. right
86+ end
7787end
7888
7989@testitem " Flipped Signs and Reversed Tspan" setup= [RootfindingTestSnippet] tags= [:core ] begin
You can’t perform that action at this time.
0 commit comments