commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdigg...@apache.org
Subject cvs commit: jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat StatUtils.java
Date Wed, 18 Jun 2003 03:05:45 GMT
mdiggory    2003/06/17 20:05:45

  Modified:    math/src/java/org/apache/commons/math/stat StatUtils.java
  Log:
  Simplified calculation, removing extra division.
  
  Revision  Changes    Path
  1.6       +2 -1      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/StatUtils.java
  
  Index: StatUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/StatUtils.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StatUtils.java	18 Jun 2003 03:01:28 -0000	1.5
  +++ StatUtils.java	18 Jun 2003 03:05:45 -0000	1.6
  @@ -180,7 +180,8 @@
   				accum += Math.pow((values[i] - mean), 2.0);
                   accum2 += (values[i] - mean);
   			}
  -			variance = (accum - (Math.pow(accum2,2)/(double)values.length)) / (double)(values.length
- 1);
  +			variance = ((accum*(double)values.length) - Math.pow(accum2,2)) / 
  +                (double)(values.length*(values.length - 1));
   		}
   		return variance;
   	}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message