test/sun/misc/FloatingDecimal/OldFloatingDecimalForTest.java

Print this page

        

@@ -21,12 +21,12 @@
  * questions.
  */
 
 //package sun.misc;
 
-import sun.misc.DoubleConsts;
-import sun.misc.FloatConsts;
+import jdk.testlibrary.DoubleUtils;
+import jdk.testlibrary.FloatUtils;
 import java.util.regex.*;
 
 public class OldFloatingDecimalForTest{
     boolean     isExceptional;
     boolean     isNegative;

@@ -2215,16 +2215,16 @@
             // correct as false.
 
 
             // Check for overflow and update exponent accordingly.
 
-            if (exponent > DoubleConsts.MAX_EXPONENT) {         // Infinite result
+            if (exponent > Double.MAX_EXPONENT) {         // Infinite result
                 // overflow to properly signed infinity
                 return new OldFloatingDecimalForTest(sign * Double.POSITIVE_INFINITY);
             } else {  // Finite return value
-                if (exponent <= DoubleConsts.MAX_EXPONENT && // (Usually) normal result
-                    exponent >= DoubleConsts.MIN_EXPONENT) {
+                if (exponent <= Double.MAX_EXPONENT && // (Usually) normal result
+                    exponent >= Double.MIN_EXPONENT) {
 
                     // The result returned in this block cannot be a
                     // zero or subnormal; however after the
                     // significand is adjusted from rounding, we could
                     // still overflow in infinity.

@@ -2234,19 +2234,19 @@
                     // rounding, this combination will update the
                     // exponent correctly, even in the case of
                     // Double.MAX_VALUE overflowing to infinity.
 
                     significand = (( (exponent +
-                                     (long)DoubleConsts.EXP_BIAS) <<
-                                     (DoubleConsts.SIGNIFICAND_WIDTH-1))
-                                   & DoubleConsts.EXP_BIT_MASK) |
-                        (DoubleConsts.SIGNIF_BIT_MASK & significand);
+                                     (long)DoubleUtils.EXP_BIAS) <<
+                                     (DoubleUtils.SIGNIFICAND_WIDTH-1))
+                                   & DoubleUtils.EXP_BIT_MASK) |
+                        (DoubleUtils.SIGNIF_BIT_MASK & significand);
 
                 }  else  {  // Subnormal or zero
-                    // (exponent < DoubleConsts.MIN_EXPONENT)
+                    // (exponent < Double.MIN_EXPONENT)
 
-                    if (exponent < (DoubleConsts.MIN_SUB_EXPONENT -1 )) {
+                    if (exponent < (DoubleUtils.MIN_SUB_EXPONENT -1 )) {
                         // No way to round back to nonzero value
                         // regardless of significand if the exponent is
                         // less than -1075.
                         return new OldFloatingDecimalForTest(sign * 0.0);
                     } else { //  -1075 <= exponent <= MIN_EXPONENT -1 = -1023

@@ -2264,11 +2264,11 @@
                         // check:
                         // -1075 +1074 + 1 = 0
                         // -1023 +1074 + 1 = 52
 
                         int bitsDiscarded = 53 -
-                            ((int)exponent - DoubleConsts.MIN_SUB_EXPONENT + 1);
+                            ((int)exponent - DoubleUtils.MIN_SUB_EXPONENT + 1);
                         assert bitsDiscarded >= 1 && bitsDiscarded <= 53;
 
                         // What to do here:
                         // First, isolate the new round bit
                         round = (significand & (1L << (bitsDiscarded -1))) != 0L;

@@ -2280,15 +2280,15 @@
                         }
 
                         // Now, discard the bits
                         significand = significand >> bitsDiscarded;
 
-                        significand = (( ((long)(DoubleConsts.MIN_EXPONENT -1) + // subnorm exp.
-                                          (long)DoubleConsts.EXP_BIAS) <<
-                                         (DoubleConsts.SIGNIFICAND_WIDTH-1))
-                                       & DoubleConsts.EXP_BIT_MASK) |
-                            (DoubleConsts.SIGNIF_BIT_MASK & significand);
+                        significand = (( ((long)(Double.MIN_EXPONENT -1) + // subnorm exp.
+                                          (long)DoubleUtils.EXP_BIAS) <<
+                                         (DoubleUtils.SIGNIFICAND_WIDTH-1))
+                                       & DoubleUtils.EXP_BIT_MASK) |
+                            (DoubleUtils.SIGNIF_BIT_MASK & significand);
                     }
                 }
 
                 // The significand variable now contains the currently
                 // appropriate exponent bits too.

@@ -2347,12 +2347,12 @@
                  * minimum (normalized) subnormal exponent - 1 since a
                  * value with that exponent can round up to the
                  * minimum subnormal value and the sticky bit
                  * information must be preserved (i.e. case 1).
                  */
-                if ((exponent >= FloatConsts.MIN_SUB_EXPONENT-1) &&
-                    (exponent <= FloatConsts.MAX_EXPONENT ) ){
+                if ((exponent >= FloatUtils.MIN_SUB_EXPONENT-1) &&
+                    (exponent <= Float.MAX_EXPONENT ) ){
                     // Outside above exponent range, the float value
                     // will be zero or infinity.
 
                     /*
                      * If the low-order 28 bits of a rounded double