Skip to content

Commit 3fade10

Browse files
Format .jl files [skip ci] (#436)
Co-authored-by: jverzani <[email protected]>
1 parent 44034e3 commit 3fade10

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/convergence.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,18 @@ function iszero_Δx(
200200
end
201201

202202
# test when fconverged to ensure not runawa
203-
function is_small_Δx(M::AbstractUnivariateZeroMethod,
204-
state::AbstractUnivariateZeroState,
205-
options)
203+
function is_small_Δx(
204+
M::AbstractUnivariateZeroMethod,
205+
state::AbstractUnivariateZeroState,
206+
options,
207+
)
206208
δ = abs(state.xn1 - state.xn0)
207209
δₐ, δᵣ = options.xabstol, options.xreltol
208210
Δₓ = max(_unitless(δₐ), _unitless(abs(state.xn1)) * δᵣ)
209211
Δₓ = sqrt(sqrt(sqrt((abs(_unitless(Δₓ)))))) # faster than x^(1/8)
210212
return δ Δₓ
211213
end
212214

213-
214215
isnan_f(M::AbstractBracketingMethod, state) = isnan(state.fxn1) || isnan(state.fxn0)
215216
isnan_f(M::AbstractNonBracketingMethod, state) = isnan(state.fxn1)
216217

@@ -313,7 +314,8 @@ function decide_convergence(
313314
# this is the case where runaway can happen
314315
## XXX Need a good heuristic to catch that
315316
is_approx_zero_f(M, state, options, :relaxed) &&
316-
is_small_Δx(M, state, options) && return xn1
317+
is_small_Δx(M, state, options) &&
318+
return xn1
317319
end
318320
end
319321

src/find_zeros.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ end
107107

108108
# adjust what we mean by x1 ~ x2 for purposes of adding a new zero
109109
function approx_close(z1, z2, xatol, xrtol)
110-
z₁,z₂,δ,ϵ = _unitless.((z1, z2, xatol, xrtol))
110+
z₁, z₂, δ, ϵ = _unitless.((z1, z2, xatol, xrtol))
111111
return isapprox(z₁, z₂; atol=sqrt(δ), rtol=sqrt(ϵ))
112112
end
113113

test/test_composable.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using ForwardDiff
4242
@test xrts[1] 1.886053370668014s
4343

4444
# issue #434
45-
xzs1=find_zeros(x -> cos(x / 1u"m"), -1.6u"m",2u"m")
45+
xzs1 = find_zeros(x -> cos(x / 1u"m"), -1.6u"m", 2u"m")
4646
@test length(xzs1) == 2 && maximum(xzs1) 1.5707963267948966 * u"m"
4747
end
4848

0 commit comments

Comments
 (0)