commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r799849 - /commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java
Date Sat, 01 Aug 2009 12:15:20 GMT
Author: luc
Date: Sat Aug  1 12:15:19 2009
New Revision: 799849

URL: http://svn.apache.org/viewvc?rev=799849&view=rev
Log:
added a protection against infinite loops that occur with some JVM (Sun before 1.4, JRockit,
...)

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java?rev=799849&r1=799848&r2=799849&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/TestProblem3.java Sat Aug
 1 12:15:19 2009
@@ -104,8 +104,8 @@
     // solve Kepler's equation
     double E = t;
     double d = 0;
-    double corr = 0;
-    do {
+    double corr = 999.0;
+    for (int i = 0; (i < 50) && (Math.abs(corr) > 1.0e-12); ++i) {
       double f2  = e * Math.sin(E);
       double f0  = d - f2;
       double f1  = 1 - e * Math.cos(E);
@@ -113,7 +113,7 @@
       corr  = f0 * f12 / (f1 * f12 - f0 * f2);
       d -= corr;
       E = t + d;
-    } while (Math.abs(corr) > 1.0e-12);
+    };
 
     double cosE = Math.cos(E);
     double sinE = Math.sin(E);



Mime
View raw message