From e8c60142b534b222dfb4c1e6733e3b4ee52b0abf Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 4 Oct 2017 11:19:30 -0700 Subject: [PATCH 1/2] Fix saveat Fixes https://github.com/JuliaDiffEq/DifferentialEquations.jl/issues/206 --- src/common.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common.jl b/src/common.jl index cfb9216c7..6503a4044 100644 --- a/src/common.jl +++ b/src/common.jl @@ -47,8 +47,11 @@ function solve{uType,tType,isinplace,AlgType<:ODEjlAlgorithm}( u0 = prob.u0 if typeof(saveat) <: Number - saveat_vec = convert(Vector{tType}, saveat+tspan[1]:saveat:(tspan[end]-saveat)) - # Exclude the endpoint because of floating point issues + if (tspan[1]:saveat:tspan[end])[end] == tspan[end] + saveat_vec = convert(Vector{tType},collect(tType,tspan[1]+saveat:saveat:tspan[end])) + else + saveat_vec = convert(Vector{tType},(collect(tType,tspan[1]+saveat:saveat:(tspan[end]-saveat))) + end else saveat_vec = convert(Vector{tType}, collect(saveat)) end From e9f6612a10a652e3baadef9efb1171821fb1b24c Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 4 Oct 2017 12:29:55 -0700 Subject: [PATCH 2/2] fix parenthesis --- src/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.jl b/src/common.jl index 6503a4044..8ff89981c 100644 --- a/src/common.jl +++ b/src/common.jl @@ -50,7 +50,7 @@ function solve{uType,tType,isinplace,AlgType<:ODEjlAlgorithm}( if (tspan[1]:saveat:tspan[end])[end] == tspan[end] saveat_vec = convert(Vector{tType},collect(tType,tspan[1]+saveat:saveat:tspan[end])) else - saveat_vec = convert(Vector{tType},(collect(tType,tspan[1]+saveat:saveat:(tspan[end]-saveat))) + saveat_vec = convert(Vector{tType},collect(tType,tspan[1]+saveat:saveat:(tspan[end]-saveat))) end else saveat_vec = convert(Vector{tType}, collect(saveat))