commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [math] Avoid slight inaccuracies at the end of events detections steps.
Date Fri, 02 Oct 2015 15:41:44 GMT
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 <luc@apache.org>
Authored: Fri Oct 2 17:37:01 2015 +0200
Committer: Luc Maisonobe <luc@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));
 


Mime
View raw message