diff --git a/src/main/java/org/apache/commons/math3/ode/events/EventState.java b/src/main/java/org/apache/commons/math3/ode/events/EventState.java index 6d3426628..cf64f36ff 100644 --- a/src/main/java/org/apache/commons/math3/ode/events/EventState.java +++ b/src/main/java/org/apache/commons/math3/ode/events/EventState.java @@ -251,7 +251,7 @@ public class EventState { for (int i = 0; i < n; ++i) { // evaluate handler value at the end of the substep - final double tb = t0 + (i + 1) * h; + final double tb = (i == n - 1) ? t1 : t0 + (i + 1) * h; interpolator.setInterpolatedTime(tb); final double gb = handler.g(tb, getCompleteState(interpolator));