Repository: commons-math
Updated Branches:
  refs/heads/MATH_3_X 5e4739fb7 -> 9f1368715


Avoid slight inaccuracies at the end of events detections steps.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/9f136871
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/9f136871
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/9f136871

Branch: refs/heads/MATH_3_X
Commit: 9f1368715bd17f518e18e283aa83d40c339534f2
Parents: 5e4739f
Author: Luc Maisonobe <l...@apache.org>
Authored: Fri Oct 2 17:34:15 2015 +0200
Committer: Luc Maisonobe <l...@apache.org>
Committed: Fri Oct 2 17:34:15 2015 +0200

----------------------------------------------------------------------
 src/main/java/org/apache/commons/math3/ode/events/EventState.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/9f136871/src/main/java/org/apache/commons/math3/ode/events/EventState.java
----------------------------------------------------------------------
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 6d34266..cf64f36 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));
 

Reply via email to