Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-163

The evaluate method and the getResult method of class Variance give different results

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Labels:
      None

      Description

      Consider the following test code:

      // construct an array of input values, containing infinity
      double[] values = new double[]

      {1.0, 2.0, Double.POSITIVE_INFINITY}

      ;
      // find the variance using Variance.evaluate(double[])
      Variance var1 = new Variance();
      double value1 = var1.evaluate(values);
      // find the variance using Variance.getResult()
      Variance var2 = new Variance();
      var2.incrementAll(values);
      double value2 = var2.getResult();
      // print out the results
      System.out.println(value1);
      System.out.println(value2);

      This code prints out:

      NaN
      Infinity

      So, we get two different variances, depending on the method we use.
      (The same is true when we use Double.NEGATIVE_INFINITY as input value instead of Double.POSITIVE_INFINITY.)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nsmeets Nele Smeets
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: