test/java/lang/Math/Tests.java

Print this page

        

@@ -28,13 +28,10 @@
  * success.  The order of arguments to the test methods is generally
  * the test name, followed by the test arguments, the computed result,
  * and finally the expected result.
  */
 
-import sun.misc.FloatConsts;
-import sun.misc.DoubleConsts;
-
 public class Tests {
     private Tests(){}; // do not instantiate
 
     public static String toHexString(float f) {
         if (!Float.isNaN(f))

@@ -79,17 +76,17 @@
      */
     public static int ilogb(double d) {
         int exponent = Math.getExponent(d);
 
         switch (exponent) {
-        case DoubleConsts.MAX_EXPONENT+1:       // NaN or infinity
+        case Double.MAX_EXPONENT+1:       // NaN or infinity
             if( Double.isNaN(d) )
                 return (1<<30);         // 2^30
             else // infinite value
                 return (1<<28);         // 2^28
 
-        case DoubleConsts.MIN_EXPONENT-1:       // zero or subnormal
+        case Double.MIN_EXPONENT-1:       // zero or subnormal
             if(d == 0.0) {
                 return -(1<<28);        // -(2^28)
             }
             else {
                 long transducer = Double.doubleToRawLongBits(d);

@@ -101,32 +98,32 @@
                  * (there must be at least one "1" bit in the
                  * significand since zero has been screened out.
                  */
 
                 // isolate significand bits
-                transducer &= DoubleConsts.SIGNIF_BIT_MASK;
+                transducer &= DoubleUtils.SIGNIF_BIT_MASK;
                 assert(transducer != 0L);
 
                 // This loop is simple and functional. We might be
                 // able to do something more clever that was faster;
                 // e.g. number of leading zero detection on
                 // (transducer << (# exponent and sign bits).
                 while (transducer <
-                       (1L << (DoubleConsts.SIGNIFICAND_WIDTH - 1))) {
+                       (1L << (DoubleUtils.SIGNIFICAND_WIDTH - 1))) {
                     transducer *= 2;
                     exponent--;
                 }
                 exponent++;
                 assert( exponent >=
-                        DoubleConsts.MIN_EXPONENT - (DoubleConsts.SIGNIFICAND_WIDTH-1) &&
-                        exponent < DoubleConsts.MIN_EXPONENT);
+                        Double.MIN_EXPONENT - (DoubleUtils.SIGNIFICAND_WIDTH-1) &&
+                        exponent < Double.MIN_EXPONENT);
                 return exponent;
             }
 
         default:
-            assert( exponent >= DoubleConsts.MIN_EXPONENT &&
-                    exponent <= DoubleConsts.MAX_EXPONENT);
+            assert( exponent >= Double.MIN_EXPONENT &&
+                    exponent <= Double.MAX_EXPONENT);
             return exponent;
         }
     }
 
     /**

@@ -148,17 +145,17 @@
      */
      public static int ilogb(float f) {
         int exponent = Math.getExponent(f);
 
         switch (exponent) {
-        case FloatConsts.MAX_EXPONENT+1:        // NaN or infinity
+        case Float.MAX_EXPONENT+1:        // NaN or infinity
             if( Float.isNaN(f) )
                 return (1<<30);         // 2^30
             else // infinite value
                 return (1<<28);         // 2^28
 
-        case FloatConsts.MIN_EXPONENT-1:        // zero or subnormal
+        case Float.MIN_EXPONENT-1:        // zero or subnormal
             if(f == 0.0f) {
                 return -(1<<28);        // -(2^28)
             }
             else {
                 int transducer = Float.floatToRawIntBits(f);

@@ -170,32 +167,32 @@
                  * (there must be at least one "1" bit in the
                  * significand since zero has been screened out.
                  */
 
                 // isolate significand bits
-                transducer &= FloatConsts.SIGNIF_BIT_MASK;
+                transducer &= FloatUtils.SIGNIF_BIT_MASK;
                 assert(transducer != 0);
 
                 // This loop is simple and functional. We might be
                 // able to do something more clever that was faster;
                 // e.g. number of leading zero detection on
                 // (transducer << (# exponent and sign bits).
                 while (transducer <
-                       (1 << (FloatConsts.SIGNIFICAND_WIDTH - 1))) {
+                       (1 << (FloatUtils.SIGNIFICAND_WIDTH - 1))) {
                     transducer *= 2;
                     exponent--;
                 }
                 exponent++;
                 assert( exponent >=
-                        FloatConsts.MIN_EXPONENT - (FloatConsts.SIGNIFICAND_WIDTH-1) &&
-                        exponent < FloatConsts.MIN_EXPONENT);
+                        Float.MIN_EXPONENT - (FloatUtils.SIGNIFICAND_WIDTH-1) &&
+                        exponent < Float.MIN_EXPONENT);
                 return exponent;
             }
 
         default:
-            assert( exponent >= FloatConsts.MIN_EXPONENT &&
-                    exponent <= FloatConsts.MAX_EXPONENT);
+            assert( exponent >= Float.MIN_EXPONENT &&
+                    exponent <= Float.MAX_EXPONENT);
             return exponent;
         }
     }
 
     /**