commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-721) building common-math on Solaris SPARC gives "error: floating point number too small"
Date Fri, 09 Dec 2011 08:04:40 GMT

    [ https://issues.apache.org/jira/browse/MATH-721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13165922#comment-13165922
] 

Luc Maisonobe commented on MATH-721:
------------------------------------

We can't use Double.MIN_NORMAL because it is only available since Java 6 and Apache Commons
Math currently targets Java 1.5.
It may be an openjdk glitch as you say. This number is a perfectly regular number, and even
smaller number exists and should be able to be used: the subnormal numbers.

Could you try using a conversion from hexadecimal encoding on your platform, using something
along this line:

  public static final double SAFE_MIN = Double.longBitsToDouble(1L << 52);
                
> building common-math on Solaris SPARC gives "error: floating point number too small"
> ------------------------------------------------------------------------------------
>
>                 Key: MATH-721
>                 URL: https://issues.apache.org/jira/browse/MATH-721
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: Build environment is:
> mvn --version
> Apache Maven 3.0.3 (rNON-CANONICAL_2011-10-13_22-23_builder; 2011-10-13 22:23:49+0200)
> Maven home: /usr/local/share/maven-3.0.3
> Java version: 1.7.0-internal, vendor: Oracle Corporation
> Java home: /usr/local/share/jdk1.7.0_1/jre
> Default locale: de_DE, platform encoding: UTF-8
> OS name: "sunos", version: "5.10", arch: "sparc", family: "unix"
>            Reporter: Jörg Prante
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message