commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1146575 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
Date Thu, 14 Jul 2011 06:12:42 GMT
Author: psteitz
Date: Thu Jul 14 06:12:42 2011
New Revision: 1146575

URL: http://svn.apache.org/viewvc?rev=1146575&view=rev
Log:
Added casts to prevent integer division.  JIRA: MATH-619

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java?rev=1146575&r1=1146574&r2=1146575&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/regression/RegressionResults.java
Thu Jul 14 06:12:42 2011
@@ -86,6 +86,7 @@ public class RegressionResults implement
             this.globalFitInfo[SST_IDX] = containsConstant ?
                     (sumysq - sumy * sumy / ((double) nobs)) : sumysq;
         }
+
         this.globalFitInfo[SSE_IDX] = sse;
         this.globalFitInfo[MSE_IDX] = this.globalFitInfo[SSE_IDX] /
                 ((double) (nobs - rank));
@@ -94,8 +95,9 @@ public class RegressionResults implement
                 this.globalFitInfo[SST_IDX];
 
         if (!containsConstant) {
-            this.globalFitInfo[ADJRSQ_IDX] = 1.0 - (1.0 - this.globalFitInfo[RSQ_IDX]) *
-                    (nobs / (nobs - rank));
+            this.globalFitInfo[ADJRSQ_IDX] = 1.0 - 
+                    (1.0 - this.globalFitInfo[RSQ_IDX]) *
+                    ( (double) nobs / ( (double) (nobs - rank)));
         } else {
             this.globalFitInfo[ADJRSQ_IDX] = 1.0 - (sse * (nobs - 1.0)) /
                     (globalFitInfo[SST_IDX] * (nobs - rank));



Mime
View raw message