This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 3be4da9c24b0bde0ffc8e68387d2b03c966365cd
Author: aherbert <[email protected]>
AuthorDate: Wed Feb 16 12:33:14 2022 +0000

    Use Double.MIN_VALUE for the SAFE_MIN constant.
---
 .../main/java/org/apache/commons/numbers/core/Precision.java  | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
index 323c338..0d1ccb0 100644
--- 
a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
+++ 
b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java
@@ -43,8 +43,10 @@ public final class Precision {
      * Safe minimum, such that {@code 1 / SAFE_MIN} does not overflow.
      * In IEEE 754 arithmetic, this is also the smallest normalized
      * number 2<sup>-1022</sup>.
+     *
+     * @see Double#MIN_NORMAL
      */
-    public static final double SAFE_MIN;
+    public static final double SAFE_MIN = Double.MIN_NORMAL;
 
     /** Exponent offset in IEEE754 representation. */
     private static final long EXPONENT_OFFSET = 1023L;
@@ -59,13 +61,6 @@ public final class Precision {
          *  constants: MATH-721
          */
         EPSILON = Double.longBitsToDouble((EXPONENT_OFFSET - 53L) << 52);
-
-        /*
-         * This was previously expressed as = 0x1.0p-1022
-         * However, OpenJDK (Sparc Solaris) cannot handle such small
-         * constants: MATH-721
-         */
-        SAFE_MIN = Double.longBitsToDouble((EXPONENT_OFFSET - 1022L) << 52);
     }
 
     /**

Reply via email to