commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject cvs commit: jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/rank Min.java
Date Fri, 18 Jun 2004 22:09:53 GMT
psteitz     2004/06/18 15:09:53

  Modified:    math/src/java/org/apache/commons/math/stat/univariate/rank
                        Min.java
  Log:
  Made increment, evaluate consistent wrt NaN, improved javadoc.
  
  Revision  Changes    Path
  1.17      +13 -13    jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/rank/Min.java
  
  Index: Min.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/stat/univariate/rank/Min.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Min.java	27 Apr 2004 16:42:33 -0000	1.16
  +++ Min.java	18 Jun 2004 22:09:53 -0000	1.17
  @@ -17,16 +17,17 @@
   
   import java.io.Serializable;
   
  -import org
  -    .apache
  -    .commons
  -    .math
  -    .stat
  -    .univariate
  -    .AbstractStorelessUnivariateStatistic;
  +import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic;
   
   /**
    * Returns the minimum of the available values.
  + * <p>
  + * <ul>
  + * <li>The result is <code>NaN</code> iff all values are <code>NaN</code>

  + * (i.e. <code>NaN</code> values have no impact on the value of the statistic).</li>
  + * <li>If any of the values equals <code>Double.NEGATIVE_INFINITY</code>,

  + * the result is <code>Double.NEGATIVE_INFINITY.</code></li>
  + * </ul> 
    * 
    * @version $Revision$ $Date$
    */
  @@ -45,7 +46,9 @@
        * @see org.apache.commons.math.stat.univariate.StorelessUnivariateStatistic#increment(double)
        */
       public void increment(final double d) {
  -        value = Double.isNaN(value) ? d : Math.min(value, d);
  +        if (d < value || Double.isNaN(value)) {
  +            value = d;
  +        }
           n++;
       }
   
  @@ -76,10 +79,7 @@
        * 
        * @see org.apache.commons.math.stat.univariate.UnivariateStatistic#evaluate(double[],
int, int)
        */
  -    public double evaluate(
  -        final double[] values,
  -        final int begin,
  -        final int length) {
  +    public double evaluate(final double[] values,final int begin, final int length) {
           double min = Double.NaN;
           if (test(values, begin, length)) {
               min = values[begin];
  
  
  

---------------------------------------------------------------------
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