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

building common-math on Solaris SPARC gives "error: floating point number too small"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 3.1
    • Labels:
      None
    • Environment:

      Description

      It seems the assumption in MathUtils.java

      /** Safe minimum, such that 1 / SAFE_MIN does not overflow.

      • <p>In IEEE 754 arithmetic, this is also the smallest normalized
      • number 2<sup>-1022</sup>.</p>
        */
        public static final double SAFE_MIN = 0x1.0p-1022;

      does not work on my openjdk 1.7.0_1 on Solaris SPARC, because I get the following build error:

      [INFO] Compiling 457 source files to /opt/builder/projects/commons-math-2.2-src/target/classes
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR :
      [INFO] -------------------------------------------------------------
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/main/java/org/apache/commons/math/util/MathUtils.java:[42,42] error: floating point number too small

      [INFO] 1error
      [INFO] -------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE

      and also in the tests I encounter the error when parsing floating point constants

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile (default-testCompile) on project commons-math: Compilation failure: Compilation failure:
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1050,69] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1055,28] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1055,69] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1056,28] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1062,70] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1063,70] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1068,70] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/util/FastMathTest.java:[1069,70] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java:[503,51] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java:[503,66] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java:[583,52] error: floating point number too small
      [ERROR]
      [ERROR] /opt/builder/projects/commons-math-2.2-src/src/test/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimatorTest.java:[585,52] error: floating point number too small

      I suggest using java.lang.Double.MIN_NORMAL for a platform normalized minimal floating point value.

      A quick program for printing Double.MIN_NORMAL gives the following result.

      class test {
      public static void main(String[] args)

      { System.out.println("min float = " + Double.MIN_NORMAL ); }

      }

      java test
      min float = 2.2250738585072014E-308

      Could it be an openjdk glitch? Thank you for any comments and help how this could be fixed.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jprante Jörg Prante
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: