You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2015/10/02 17:41:44 UTC

[math] Avoid slight inaccuracies at the end of events detections steps.

Repository: commons-math
Updated Branches:
  refs/heads/master 66d0a9a0a -> 1b5925b56


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/1b5925b5
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/1b5925b5
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/1b5925b5

Branch: refs/heads/master
Commit: 1b5925b5632494c77bdffc9e89d149f5f88fe17f
Parents: 66d0a9a
Author: Luc Maisonobe <lu...@apache.org>
Authored: Fri Oct 2 17:37:01 2015 +0200
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Fri Oct 2 17:37:01 2015 +0200

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


http://git-wip-us.apache.org/repos/asf/commons-math/blob/1b5925b5/src/main/java/org/apache/commons/math4/ode/events/EventState.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/EventState.java b/src/main/java/org/apache/commons/math4/ode/events/EventState.java
index 1908440..f4abfb3 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/EventState.java
+++ b/src/main/java/org/apache/commons/math4/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));