Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6339

[classlib] [math] Sample test case showing Math differences

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.0M12
    • Classlib
    • None

    Description

      Below is a simple test case which works in the Sun Java 1.5 but fails in Harmony.

      This is derived from the HyperGeometricDistribution test, but is hopefully a bit easier to debug.

      import org.apache.commons.math.util.MathUtils;

      public class HarmMath {

      private static void bcl(int m, int x, double exp)

      { final double logmx = MathUtils.binomialCoefficientLog(m, x); System.out.println(m+","+x+"="+logmx+" "+(logmx==exp?" == ":" != ")+" "+exp); }

      public static void main(String[] args) {
      int[][]mk={{101,84},

      {101,83}

      ,

      {101,60}

      ,

      {101,18}

      ,{101,17}};
      double[]r=

      {43.52547252799755,45.065917568944705,65.69211086727145,45.065917568944705,43.52547252799755}

      ;
      for(int j=0; j<mk.length;j++)

      { bcl(mk[j][0],mk[j][1],r[j]); }

      }

      }

      The cases 101,83; 101,60; and 101,18 generate different results on Harmony.

      Attachments

        Issue Links

          Activity

            People

              tellison Tim Ellison
              sebb Sebb
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: