Skip to content

Commit 0305c9d

Browse files
test: test Float32 values retained in problem construction
1 parent 50f932f commit 0305c9d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/initial_values.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,16 @@ end
252252
ps = [p => [4.0, 5.0]]
253253
@test_nowarn NonlinearProblem(nlsys, u0, ps)
254254
end
255+
256+
@testset "Issue#3553: Retain `Float32` initial values" begin
257+
@parameters p d
258+
@variables X(t)
259+
eqs = [D(X) ~ p - d * X]
260+
@mtkbuild osys = ODESystem(eqs, t)
261+
u0 = [X => 1.0f0]
262+
ps = [p => 1.0f0, d => 2.0f0]
263+
oprob = ODEProblem(osys, u0, (0.0f0, 1.0f0), ps)
264+
sol = solve(oprob)
265+
@test eltype(oprob.u0) == Float32
266+
@test eltype(eltype(sol.u)) == Float32
267+
end

0 commit comments

Comments
 (0)