Skip to content

Commit d9f56cb

Browse files
fix: avoid enum regression in error estimate init
1 parent a18ac43 commit d9f56cb

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/OrdinaryDiffEqCore/src/solve.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function _ode_init(
318318

319319
scalar_type_tol =
320320
uBottomEltypeNoUnits == uBottomEltype &&
321-
uBottomEltype <: Union{Real,Complex}
321+
uBottomEltype <: Union{Real, Complex}
322322

323323
if prob isa SciMLBase.AbstractDiscreteProblem && abstol === nothing
324324
abstol_internal = false
@@ -695,8 +695,11 @@ function _ode_init(
695695
kshortsize = 0
696696
reeval_fsal = false
697697
u_modified = false
698-
# Avoid calling oneunit on a Quantity *type* (DynamicQuantities stores dimensions at runtime).
699-
EEst = oneunit(internalnorm(u, t)) # https://github.com/JuliaPhysics/Measurements.jl/pull/135
698+
EEst = try
699+
oneunit(EEstT)
700+
catch
701+
oneunit(internalnorm(u, t))
702+
end # https://github.com/JuliaPhysics/Measurements.jl/pull/135
700703
just_hit_tstop = false
701704
next_step_tstop = false
702705
tstop_target = zero(t)

lib/OrdinaryDiffEqCore/test/dynamicquantities_measurements.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ using Test
1212
f(u, p, t) = u / (1u"s")
1313
prob = ODEProblem(f, u0, tspan)
1414

15-
sol = solve(prob, Tsit5(); abstol = 1e-9, reltol = 1e-9)
15+
sol = solve(prob, Tsit5(); abstol = 1.0e-9, reltol = 1.0e-9)
1616

1717
@test sol.u[end] isa typeof(u0)
1818
@test eltype(sol.u) == typeof(u0)
1919

2020
uend_m = ustrip(u"m", sol.u[end])
21-
@test isapprox(Measurements.value(uend_m), exp(1); atol = 1e-6)
21+
@test isapprox(Measurements.value(uend_m), exp(1); atol = 1.0e-6)
2222
@test Measurements.uncertainty(uend_m) > 0
2323
end

0 commit comments

Comments
 (0)