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

test results depend on java version



    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2
    • Labels:
    • Environment:

      GNU/Linux (ubuntu Gutsy Gibbon), java 1.3: eclipse compiler, java 1.4: Blackdown-1.4.2-02, java 1.6: SUN 1.6.0_03-b05, AMD athlon XP2000+


      Running the tests with maven and changing the java version used by changing JAVA_HOME in the ~/.mavenrc file, I get different results.

      With the Eclipse compiler set to 1.3 compatibility and with blackdown jvm (1.4), the tests succed.
      With the Sun jvm (1.6), SummaryStatisticsAbstractTest.testEqualsAndHashCode (which is used both by SummaryStatisticsTest and SynchronizedSummaryStatisticsTest) fails.

      The error is related to geometric mean computation, which lead to slightly different results depending on the order of added elements. One instance returns 2.213363839400643 and the other returns 2.2133638394006434. Both results are consistent with IEEE754 arithmetic (they differ in the last two bits).

      Using Sun 1.6.0_03 jvm, the different values induce a test failure when SummaryStatistics.equals() method is called (it checks for exact equality). If this part of the test is commented out, another failure occurs when the SummaryStatistics.hashcode() method is called.

      Changing the equals method would be possible, but would be a change of semantics and would imply choosing some threshold which would never suit everybody needs. Changing the hashcode method simply does not seem realistic to me. So I would like to keep these methods as they are now. So the main conclusion would be that the test is too sensitive to jvm implementation (which are consistent with IEEE754 arithmetic in this case).

      I don't know what to do about this issue.




            • Assignee:
              luc Luc Maisonobe
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: