--- old/test/java/lang/Double/BitwiseConversion.java 2014-08-15 13:26:08.000000000 +0800
+++ new/test/java/lang/Double/BitwiseConversion.java 2014-08-15 13:26:08.000000000 +0800
@@ -25,11 +25,14 @@
* @test
* @bug 5037596
* @summary Verify bitwise conversion works for non-canonical NaN values
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils
+ * @run main BitwiseConversion
* @author Joseph D. Darcy
*/
import static java.lang.Double.*;
-import static sun.misc.DoubleConsts.*;
+import static jdk.testlibrary.DoubleUtils.*;
public class BitwiseConversion {
static int testNanCase(long x) {
--- old/test/java/lang/Double/ParseHexFloatingPoint.java 2014-08-15 13:26:08.000000000 +0800
+++ new/test/java/lang/Double/ParseHexFloatingPoint.java 2014-08-15 13:26:08.000000000 +0800
@@ -30,7 +30,6 @@
import java.util.regex.*;
-import sun.misc.DoubleConsts;
public class ParseHexFloatingPoint {
private ParseHexFloatingPoint(){}
@@ -158,8 +157,8 @@
}
long bigExponents [] = {
- 2*DoubleConsts.MAX_EXPONENT,
- 2*DoubleConsts.MIN_EXPONENT,
+ 2*Double.MAX_EXPONENT,
+ 2*Double.MIN_EXPONENT,
(long)Integer.MAX_VALUE-1,
(long)Integer.MAX_VALUE,
@@ -226,11 +225,11 @@
new PairSD("0x1.000000000000001p-1075", Double.MIN_VALUE),
// More subnormal rounding tests
- new PairSD("0x0.fffffffffffff7fffffp-1022", Math.nextDown(DoubleConsts.MIN_NORMAL)),
- new PairSD("0x0.fffffffffffff8p-1022", DoubleConsts.MIN_NORMAL),
- new PairSD("0x0.fffffffffffff800000001p-1022",DoubleConsts.MIN_NORMAL),
- new PairSD("0x0.fffffffffffff80000000000000001p-1022",DoubleConsts.MIN_NORMAL),
- new PairSD("0x1.0p-1022", DoubleConsts.MIN_NORMAL),
+ new PairSD("0x0.fffffffffffff7fffffp-1022", Math.nextDown(Double.MIN_NORMAL)),
+ new PairSD("0x0.fffffffffffff8p-1022", Double.MIN_NORMAL),
+ new PairSD("0x0.fffffffffffff800000001p-1022",Double.MIN_NORMAL),
+ new PairSD("0x0.fffffffffffff80000000000000001p-1022",Double.MIN_NORMAL),
+ new PairSD("0x1.0p-1022", Double.MIN_NORMAL),
// Large value and overflow rounding tests
--- old/test/java/lang/Double/ToHexString.java 2014-08-15 13:26:09.000000000 +0800
+++ new/test/java/lang/Double/ToHexString.java 2014-08-15 13:26:09.000000000 +0800
@@ -25,11 +25,14 @@
* @test
* @bug 4826774 4926547
* @summary Tests for {Float, Double}.toHexString methods
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils
+ * @run main ToHexString
* @author Joseph D. Darcy
*/
import java.util.regex.*;
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
public class ToHexString {
private ToHexString() {}
@@ -80,10 +83,10 @@
else { // finite value
// Extract exponent
int exponent = Integer.parseInt(transString.substring(0,3), 16) -
- DoubleConsts.EXP_BIAS;
+ EXP_BIAS;
result.append("0x");
- if (exponent == DoubleConsts.MIN_EXPONENT - 1) { // zero or subnormal
+ if (exponent == Double.MIN_EXPONENT - 1) { // zero or subnormal
if(signifString.equals("0000000000000")) {
result.append("0.0p0");
}
--- old/test/java/lang/Float/BitwiseConversion.java 2014-08-15 13:26:10.000000000 +0800
+++ new/test/java/lang/Float/BitwiseConversion.java 2014-08-15 13:26:10.000000000 +0800
@@ -25,11 +25,14 @@
* @test
* @bug 5037596
* @summary Verify bitwise conversion works for non-canonical NaN values
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.FloatUtils
+ * @run main BitwiseConversion
* @author Joseph D. Darcy
*/
import static java.lang.Float.*;
-import static sun.misc.FloatConsts.*;
+import static jdk.testlibrary.FloatUtils.*;
public class BitwiseConversion {
static int testNanCase(int x) {
--- old/test/java/lang/Math/Atan2Tests.java 2014-08-15 13:26:10.000000000 +0800
+++ new/test/java/lang/Math/Atan2Tests.java 2014-08-15 13:26:10.000000000 +0800
@@ -25,6 +25,9 @@
* @test
* @bug 4984407
* @summary Tests for {Math, StrictMath}.atan2
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main Atan2Tests
* @author Joseph D. Darcy
*/
--- old/test/java/lang/Math/CeilAndFloorTests.java 2014-08-15 13:26:11.000000000 +0800
+++ new/test/java/lang/Math/CeilAndFloorTests.java 2014-08-15 13:26:11.000000000 +0800
@@ -25,10 +25,11 @@
* @test
* @bug 6908131
* @summary Check for correct implementation of Math.ceil and Math.floor
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main CeilAndFloorTests
*/
-import sun.misc.DoubleConsts;
-
public class CeilAndFloorTests {
private static int testCeilCase(double input, double expected) {
int failures = 0;
@@ -139,10 +140,10 @@
double [][] testCases = {
{ Double.MIN_VALUE, 1.0},
{-Double.MIN_VALUE, -0.0},
- { Math.nextDown(DoubleConsts.MIN_NORMAL), 1.0},
- {-Math.nextDown(DoubleConsts.MIN_NORMAL), -0.0},
- { DoubleConsts.MIN_NORMAL, 1.0},
- {-DoubleConsts.MIN_NORMAL, -0.0},
+ { Math.nextDown(Double.MIN_NORMAL), 1.0},
+ {-Math.nextDown(Double.MIN_NORMAL), -0.0},
+ { Double.MIN_NORMAL, 1.0},
+ {-Double.MIN_NORMAL, -0.0},
{ 0.1, 1.0},
{-0.1, -0.0},
--- old/test/java/lang/Math/CubeRootTests.java 2014-08-15 13:26:12.000000000 +0800
+++ new/test/java/lang/Math/CubeRootTests.java 2014-08-15 13:26:11.000000000 +0800
@@ -25,10 +25,13 @@
* @test
* @bug 4347132 4939441
* @summary Tests for {Math, StrictMath}.cbrt
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main CubeRootTests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
public class CubeRootTests {
private CubeRootTests(){}
@@ -93,13 +96,13 @@
}
// Test cbrt(2^(3n)) = 2^n.
- for(int i = 18; i <= DoubleConsts.MAX_EXPONENT/3; i++) {
+ for(int i = 18; i <= Double.MAX_EXPONENT/3; i++) {
failures += testCubeRootCase(Math.scalb(1.0, 3*i),
Math.scalb(1.0, i) );
}
// Test cbrt(2^(-3n)) = 2^-n.
- for(int i = -1; i >= DoubleConsts.MIN_SUB_EXPONENT/3; i--) {
+ for(int i = -1; i >= MIN_SUB_EXPONENT/3; i--) {
failures += testCubeRootCase(Math.scalb(1.0, 3*i),
Math.scalb(1.0, i) );
}
@@ -110,10 +113,10 @@
// is less than the number of bits in a double's significand.
long exponentBits1 =
Double.doubleToLongBits(Math.scalb(1.0, 55)) &
- DoubleConsts.EXP_BIT_MASK;
+ EXP_BIT_MASK;
long exponentBits2=
Double.doubleToLongBits(Math.scalb(1.0, -55)) &
- DoubleConsts.EXP_BIT_MASK;
+ EXP_BIT_MASK;
for(int i = 0; i < 100; i++) {
// Take 16 bits since the 17th bit is implicit in the
// exponent
@@ -121,14 +124,14 @@
Double.longBitsToDouble(exponentBits1 |
// Significand bits
((long) (rand.nextInt() & 0xFFFF))<<
- (DoubleConsts.SIGNIFICAND_WIDTH-1-16));
+ (SIGNIFICAND_WIDTH-1-16));
failures += testCubeRootCase(input1*input1*input1, input1);
double input2 =
Double.longBitsToDouble(exponentBits2 |
// Significand bits
((long) (rand.nextInt() & 0xFFFF))<<
- (DoubleConsts.SIGNIFICAND_WIDTH-1-16));
+ (SIGNIFICAND_WIDTH-1-16));
failures += testCubeRootCase(input2*input2*input2, input2);
}
@@ -240,7 +243,7 @@
double pcNeighborsStrictCbrt[] = new double[5];
// Test near cbrt(2^(3n)) = 2^n.
- for(int i = 18; i <= DoubleConsts.MAX_EXPONENT/3; i++) {
+ for(int i = 18; i <= Double.MAX_EXPONENT/3; i++) {
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
@@ -279,7 +282,7 @@
}
// Test near cbrt(2^(-3n)) = 2^-n.
- for(int i = -1; i >= DoubleConsts.MIN_SUB_EXPONENT/3; i--) {
+ for(int i = -1; i >= MIN_SUB_EXPONENT/3; i--) {
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
--- old/test/java/lang/Math/Expm1Tests.java 2014-08-15 13:26:12.000000000 +0800
+++ new/test/java/lang/Math/Expm1Tests.java 2014-08-15 13:26:12.000000000 +0800
@@ -25,10 +25,13 @@
* @test
* @bug 4851638 4900189 4939441
* @summary Tests for {Math, StrictMath}.expm1
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main Expm1Tests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
/*
* The Taylor expansion of expxm1(x) = exp(x) -1 is
@@ -80,7 +83,7 @@
// For |x| < 2^-54 expm1(x) ~= x
- for(int i = DoubleConsts.MIN_SUB_EXPONENT; i <= -54; i++) {
+ for(int i = MIN_SUB_EXPONENT; i <= -54; i++) {
double d = Math.scalb(2, i);
failures += testExpm1Case(d, d);
failures += testExpm1Case(-d, -d);
@@ -99,7 +102,7 @@
}
// For x > 710, expm1(x) should be infinity
- for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = 10; i <= Double.MAX_EXPONENT; i++) {
double d = Math.scalb(2, i);
failures += testExpm1Case(d, infinityD);
}
@@ -116,7 +119,7 @@
reachedLimit);
}
- for(int i = 7; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = 7; i <= Double.MAX_EXPONENT; i++) {
double d = -Math.scalb(2, i);
failures += testExpm1CaseWithUlpDiff(d, -1.0, 1, reachedLimit);
}
--- old/test/java/lang/Math/HyperbolicTests.java 2014-08-15 13:26:13.000000000 +0800
+++ new/test/java/lang/Math/HyperbolicTests.java 2014-08-15 13:26:13.000000000 +0800
@@ -25,10 +25,13 @@
* @test
* @bug 4851625 4900189 4939441
* @summary Tests for {Math, StrictMath}.{sinh, cosh, tanh}
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main HyperbolicTests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
public class HyperbolicTests {
private HyperbolicTests(){}
@@ -264,7 +267,7 @@
// rounded away since |n-n^3| > 53, the binary precision of a
// double significand.
- for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) {
+ for(int i = MIN_SUB_EXPONENT; i < -27; i++) {
double d = Math.scalb(2.0, i);
// Result and expected are the same.
@@ -342,7 +345,7 @@
// sinh(x) overflows for values greater than 710; in
// particular, it overflows for all 2^i, i > 10.
- for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = 10; i <= Double.MAX_EXPONENT; i++) {
double d = Math.scalb(2.0, i);
// Result and expected are the same.
@@ -623,7 +626,7 @@
// subsequent terms of the Taylor series expansion will get
// rounded.
- for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) {
+ for(int i = MIN_SUB_EXPONENT; i < -27; i++) {
double d = Math.scalb(2.0, i);
// Result and expected are the same.
@@ -701,7 +704,7 @@
// cosh(x) overflows for values greater than 710; in
// particular, it overflows for all 2^i, i > 10.
- for(int i = 10; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = 10; i <= Double.MAX_EXPONENT; i++) {
double d = Math.scalb(2.0, i);
// Result and expected are the same.
@@ -982,7 +985,7 @@
// rounded away since |n-n^3| > 53, the binary precision of a
// double significand.
- for(int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) {
+ for(int i = MIN_SUB_EXPONENT; i < -27; i++) {
double d = Math.scalb(2.0, i);
// Result and expected are the same.
@@ -996,7 +999,7 @@
failures += testTanhCaseWithUlpDiff(i, 1.0, 2.5);
}
- for(int i = 5; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = 5; i <= Double.MAX_EXPONENT; i++) {
double d = Math.scalb(2.0, i);
failures += testTanhCaseWithUlpDiff(d, 1.0, 2.5);
--- old/test/java/lang/Math/HypotTests.java 2014-08-15 13:26:13.000000000 +0800
+++ new/test/java/lang/Math/HypotTests.java 2014-08-15 13:26:13.000000000 +0800
@@ -25,10 +25,13 @@
* @test
* @bug 4851638 4939441
* @summary Tests for {Math, StrictMath}.hypot
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main HypotTests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
public class HypotTests {
private HypotTests(){}
@@ -86,8 +89,8 @@
// Verify hypot(x, 0.0) is close to x over the entire exponent
// range.
- for(int i = DoubleConsts.MIN_SUB_EXPONENT;
- i <= DoubleConsts.MAX_EXPONENT;
+ for(int i = MIN_SUB_EXPONENT;
+ i <= Double.MAX_EXPONENT;
i++) {
double input = Math.scalb(2, i);
failures += testHypotCase(input, 0.0, input);
@@ -125,7 +128,7 @@
for(int i = 0; i < 1000; i++) {
double d = rand.nextDouble();
// Scale d to have an exponent equal to MAX_EXPONENT -15
- d = Math.scalb(d, DoubleConsts.MAX_EXPONENT
+ d = Math.scalb(d, Double.MAX_EXPONENT
-15 - Tests.ilogb(d));
for(int j = 0; j <= 13; j += 1) {
failures += testHypotCase(3*d, 4*d, 5*d, 2.5);
--- old/test/java/lang/Math/IeeeRecommendedTests.java 2014-08-15 13:26:14.000000000 +0800
+++ new/test/java/lang/Math/IeeeRecommendedTests.java 2014-08-15 13:26:14.000000000 +0800
@@ -25,11 +25,14 @@
* @test
* @bug 4860891 4826732 4780454 4939441 4826652
* @summary Tests for IEEE 754[R] recommended functions and similar methods
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main IeeeRecommendedTests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
-import sun.misc.FloatConsts;
+import jdk.testlibrary.DoubleUtils;
+import jdk.testlibrary.FloatUtils;
public class IeeeRecommendedTests {
private IeeeRecommendedTests(){}
@@ -54,18 +57,18 @@
* Returns a floating-point power of two in the normal range.
*/
static double powerOfTwoD(int n) {
- return Double.longBitsToDouble((((long)n + (long)DoubleConsts.MAX_EXPONENT) <<
- (DoubleConsts.SIGNIFICAND_WIDTH-1))
- & DoubleConsts.EXP_BIT_MASK);
+ return Double.longBitsToDouble((((long)n + (long)Double.MAX_EXPONENT) <<
+ (DoubleUtils.SIGNIFICAND_WIDTH-1))
+ & DoubleUtils.EXP_BIT_MASK);
}
/**
* Returns a floating-point power of two in the normal range.
*/
static float powerOfTwoF(int n) {
- return Float.intBitsToFloat(((n + FloatConsts.MAX_EXPONENT) <<
- (FloatConsts.SIGNIFICAND_WIDTH-1))
- & FloatConsts.EXP_BIT_MASK);
+ return Float.intBitsToFloat(((n + Float.MAX_EXPONENT) <<
+ (FloatUtils.SIGNIFICAND_WIDTH-1))
+ & FloatUtils.EXP_BIT_MASK);
}
/* ******************** getExponent tests ****************************** */
@@ -129,7 +132,7 @@
+16.0f,
+Float.MIN_VALUE,
+Float_MAX_SUBNORMAL,
- +FloatConsts.MIN_NORMAL,
+ +Float.MIN_NORMAL,
+Float.MAX_VALUE
};
@@ -139,10 +142,10 @@
0,
1,
4,
- FloatConsts.MIN_EXPONENT - 1,
- -FloatConsts.MAX_EXPONENT,
- FloatConsts.MIN_EXPONENT,
- FloatConsts.MAX_EXPONENT
+ Float.MIN_EXPONENT - 1,
+ -Float.MAX_EXPONENT,
+ Float.MIN_EXPONENT,
+ Float.MAX_EXPONENT
};
// Special value tests
@@ -152,7 +155,7 @@
// Normal exponent tests
- for(int i = FloatConsts.MIN_EXPONENT; i <= FloatConsts.MAX_EXPONENT; i++) {
+ for(int i = Float.MIN_EXPONENT; i <= Float.MAX_EXPONENT; i++) {
int result;
// Create power of two
@@ -167,15 +170,15 @@
randFloat = Float.intBitsToFloat( // Exponent
(Float.floatToIntBits(po2)&
- (~FloatConsts.SIGNIF_BIT_MASK)) |
+ (~FloatUtils.SIGNIF_BIT_MASK)) |
// Significand
(randSignif &
- FloatConsts.SIGNIF_BIT_MASK) );
+ FloatUtils.SIGNIF_BIT_MASK) );
failures += testGetExponentCase(randFloat, i);
}
- if (i > FloatConsts.MIN_EXPONENT) {
+ if (i > Float.MIN_EXPONENT) {
float po2minus = Math.nextAfter(po2,
Float.NEGATIVE_INFINITY);
failures += testGetExponentCase(po2minus, i-1);
@@ -195,17 +198,17 @@
float top=Float.MIN_VALUE;
for( int i = 1;
- i < FloatConsts.SIGNIFICAND_WIDTH;
+ i < FloatUtils.SIGNIFICAND_WIDTH;
i++, top *= 2.0f) {
failures += testGetExponentCase(top,
- FloatConsts.MIN_EXPONENT - 1);
+ Float.MIN_EXPONENT - 1);
// Test largest value in next smaller binade
if (i >= 3) {// (i == 1) would test 0.0;
// (i == 2) would just retest MIN_VALUE
testGetExponentCase(Math.nextAfter(top, 0.0f),
- FloatConsts.MIN_EXPONENT - 1);
+ Float.MIN_EXPONENT - 1);
if( i >= 10) {
// create a bit mask with (i-1) 1's in the low order
@@ -217,7 +220,7 @@
(rand.nextInt() & mask ) ) ;
failures += testGetExponentCase(randFloat,
- FloatConsts.MIN_EXPONENT - 1);
+ Float.MIN_EXPONENT - 1);
}
}
}
@@ -236,7 +239,7 @@
+16.0,
+Double.MIN_VALUE,
+Double_MAX_SUBNORMAL,
- +DoubleConsts.MIN_NORMAL,
+ +Double.MIN_NORMAL,
+Double.MAX_VALUE
};
@@ -246,10 +249,10 @@
0,
1,
4,
- DoubleConsts.MIN_EXPONENT - 1,
- -DoubleConsts.MAX_EXPONENT,
- DoubleConsts.MIN_EXPONENT,
- DoubleConsts.MAX_EXPONENT
+ Double.MIN_EXPONENT - 1,
+ -Double.MAX_EXPONENT,
+ Double.MIN_EXPONENT,
+ Double.MAX_EXPONENT
};
// Special value tests
@@ -259,7 +262,7 @@
// Normal exponent tests
- for(int i = DoubleConsts.MIN_EXPONENT; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = Double.MIN_EXPONENT; i <= Double.MAX_EXPONENT; i++) {
int result;
// Create power of two
@@ -274,15 +277,15 @@
randFloat = Double.longBitsToDouble( // Exponent
(Double.doubleToLongBits(po2)&
- (~DoubleConsts.SIGNIF_BIT_MASK)) |
+ (~DoubleUtils.SIGNIF_BIT_MASK)) |
// Significand
(randSignif &
- DoubleConsts.SIGNIF_BIT_MASK) );
+ DoubleUtils.SIGNIF_BIT_MASK) );
failures += testGetExponentCase(randFloat, i);
}
- if (i > DoubleConsts.MIN_EXPONENT) {
+ if (i > Double.MIN_EXPONENT) {
double po2minus = Math.nextAfter(po2,
Double.NEGATIVE_INFINITY);
failures += testGetExponentCase(po2minus, i-1);
@@ -302,17 +305,17 @@
double top=Double.MIN_VALUE;
for( int i = 1;
- i < DoubleConsts.SIGNIFICAND_WIDTH;
+ i < DoubleUtils.SIGNIFICAND_WIDTH;
i++, top *= 2.0f) {
failures += testGetExponentCase(top,
- DoubleConsts.MIN_EXPONENT - 1);
+ Double.MIN_EXPONENT - 1);
// Test largest value in next smaller binade
if (i >= 3) {// (i == 1) would test 0.0;
// (i == 2) would just retest MIN_VALUE
testGetExponentCase(Math.nextAfter(top, 0.0),
- DoubleConsts.MIN_EXPONENT - 1);
+ Double.MIN_EXPONENT - 1);
if( i >= 10) {
// create a bit mask with (i-1) 1's in the low order
@@ -324,7 +327,7 @@
(rand.nextLong() & mask ) ) ;
failures += testGetExponentCase(randFloat,
- DoubleConsts.MIN_EXPONENT - 1);
+ Double.MIN_EXPONENT - 1);
}
}
}
@@ -400,15 +403,15 @@
{Float_MAX_VALUEmm, infinityF, Float.MAX_VALUE},
{Float_MAX_VALUEmm, Float_MAX_VALUEmm, Float_MAX_VALUEmm},
- {FloatConsts.MIN_NORMAL, infinityF, FloatConsts.MIN_NORMAL+
+ {Float.MIN_NORMAL, infinityF, Float.MIN_NORMAL+
Float.MIN_VALUE},
- {FloatConsts.MIN_NORMAL, -infinityF, Float_MAX_SUBNORMAL},
- {FloatConsts.MIN_NORMAL, 1.0f, FloatConsts.MIN_NORMAL+
+ {Float.MIN_NORMAL, -infinityF, Float_MAX_SUBNORMAL},
+ {Float.MIN_NORMAL, 1.0f, Float.MIN_NORMAL+
Float.MIN_VALUE},
- {FloatConsts.MIN_NORMAL, -1.0f, Float_MAX_SUBNORMAL},
- {FloatConsts.MIN_NORMAL, FloatConsts.MIN_NORMAL, FloatConsts.MIN_NORMAL},
+ {Float.MIN_NORMAL, -1.0f, Float_MAX_SUBNORMAL},
+ {Float.MIN_NORMAL, Float.MIN_NORMAL, Float.MIN_NORMAL},
- {Float_MAX_SUBNORMAL, FloatConsts.MIN_NORMAL, FloatConsts.MIN_NORMAL},
+ {Float_MAX_SUBNORMAL, Float.MIN_NORMAL, Float.MIN_NORMAL},
{Float_MAX_SUBNORMAL, Float_MAX_SUBNORMAL, Float_MAX_SUBNORMAL},
{Float_MAX_SUBNORMAL, 0.0f, Float_MAX_SUBNORMALmm},
@@ -472,15 +475,15 @@
{Double_MAX_VALUEmm, infinityD, Double.MAX_VALUE},
{Double_MAX_VALUEmm, Double_MAX_VALUEmm, Double_MAX_VALUEmm},
- {DoubleConsts.MIN_NORMAL, infinityD, DoubleConsts.MIN_NORMAL+
+ {Double.MIN_NORMAL, infinityD, Double.MIN_NORMAL+
Double.MIN_VALUE},
- {DoubleConsts.MIN_NORMAL, -infinityD, Double_MAX_SUBNORMAL},
- {DoubleConsts.MIN_NORMAL, 1.0f, DoubleConsts.MIN_NORMAL+
+ {Double.MIN_NORMAL, -infinityD, Double_MAX_SUBNORMAL},
+ {Double.MIN_NORMAL, 1.0f, Double.MIN_NORMAL+
Double.MIN_VALUE},
- {DoubleConsts.MIN_NORMAL, -1.0f, Double_MAX_SUBNORMAL},
- {DoubleConsts.MIN_NORMAL, DoubleConsts.MIN_NORMAL,DoubleConsts.MIN_NORMAL},
+ {Double.MIN_NORMAL, -1.0f, Double_MAX_SUBNORMAL},
+ {Double.MIN_NORMAL, Double.MIN_NORMAL, Double.MIN_NORMAL},
- {Double_MAX_SUBNORMAL, DoubleConsts.MIN_NORMAL,DoubleConsts.MIN_NORMAL},
+ {Double_MAX_SUBNORMAL, Double.MIN_NORMAL, Double.MIN_NORMAL},
{Double_MAX_SUBNORMAL, Double_MAX_SUBNORMAL, Double_MAX_SUBNORMAL},
{Double_MAX_SUBNORMAL, 0.0d, Double_MAX_SUBNORMALmm},
@@ -529,15 +532,15 @@
{NaNf, NaNf},
{-infinityF, -Float.MAX_VALUE},
{-Float.MAX_VALUE, -Float_MAX_VALUEmm},
- {-FloatConsts.MIN_NORMAL, -Float_MAX_SUBNORMAL},
+ {-Float.MIN_NORMAL, -Float_MAX_SUBNORMAL},
{-Float_MAX_SUBNORMAL, -Float_MAX_SUBNORMALmm},
{-Float.MIN_VALUE, -0.0f},
{-0.0f, Float.MIN_VALUE},
{+0.0f, Float.MIN_VALUE},
{Float.MIN_VALUE, Float.MIN_VALUE*2},
{Float_MAX_SUBNORMALmm, Float_MAX_SUBNORMAL},
- {Float_MAX_SUBNORMAL, FloatConsts.MIN_NORMAL},
- {FloatConsts.MIN_NORMAL, FloatConsts.MIN_NORMAL+Float.MIN_VALUE},
+ {Float_MAX_SUBNORMAL, Float.MIN_NORMAL},
+ {Float.MIN_NORMAL, Float.MIN_NORMAL+Float.MIN_VALUE},
{Float_MAX_VALUEmm, Float.MAX_VALUE},
{Float.MAX_VALUE, infinityF},
{infinityF, infinityF}
@@ -567,15 +570,15 @@
{NaNd, NaNd},
{-infinityD, -Double.MAX_VALUE},
{-Double.MAX_VALUE, -Double_MAX_VALUEmm},
- {-DoubleConsts.MIN_NORMAL, -Double_MAX_SUBNORMAL},
+ {-Double.MIN_NORMAL, -Double_MAX_SUBNORMAL},
{-Double_MAX_SUBNORMAL, -Double_MAX_SUBNORMALmm},
{-Double.MIN_VALUE, -0.0d},
{-0.0d, Double.MIN_VALUE},
{+0.0d, Double.MIN_VALUE},
{Double.MIN_VALUE, Double.MIN_VALUE*2},
{Double_MAX_SUBNORMALmm, Double_MAX_SUBNORMAL},
- {Double_MAX_SUBNORMAL, DoubleConsts.MIN_NORMAL},
- {DoubleConsts.MIN_NORMAL, DoubleConsts.MIN_NORMAL+Double.MIN_VALUE},
+ {Double_MAX_SUBNORMAL, Double.MIN_NORMAL},
+ {Double.MIN_NORMAL, Double.MIN_NORMAL+Double.MIN_VALUE},
{Double_MAX_VALUEmm, Double.MAX_VALUE},
{Double.MAX_VALUE, infinityD},
{infinityD, infinityD}
@@ -607,16 +610,16 @@
{-infinityF, -infinityF},
{-Float.MAX_VALUE, -infinityF},
{-Float_MAX_VALUEmm, -Float.MAX_VALUE},
- {-Float_MAX_SUBNORMAL, -FloatConsts.MIN_NORMAL},
+ {-Float_MAX_SUBNORMAL, -Float.MIN_NORMAL},
{-Float_MAX_SUBNORMALmm, -Float_MAX_SUBNORMAL},
{-0.0f, -Float.MIN_VALUE},
{+0.0f, -Float.MIN_VALUE},
{Float.MIN_VALUE, 0.0f},
{Float.MIN_VALUE*2, Float.MIN_VALUE},
{Float_MAX_SUBNORMAL, Float_MAX_SUBNORMALmm},
- {FloatConsts.MIN_NORMAL, Float_MAX_SUBNORMAL},
- {FloatConsts.MIN_NORMAL+
- Float.MIN_VALUE, FloatConsts.MIN_NORMAL},
+ {Float.MIN_NORMAL, Float_MAX_SUBNORMAL},
+ {Float.MIN_NORMAL+
+ Float.MIN_VALUE, Float.MIN_NORMAL},
{Float.MAX_VALUE, Float_MAX_VALUEmm},
{infinityF, Float.MAX_VALUE},
};
@@ -646,16 +649,16 @@
{-infinityD, -infinityD},
{-Double.MAX_VALUE, -infinityD},
{-Double_MAX_VALUEmm, -Double.MAX_VALUE},
- {-Double_MAX_SUBNORMAL, -DoubleConsts.MIN_NORMAL},
+ {-Double_MAX_SUBNORMAL, -Double.MIN_NORMAL},
{-Double_MAX_SUBNORMALmm, -Double_MAX_SUBNORMAL},
{-0.0d, -Double.MIN_VALUE},
{+0.0d, -Double.MIN_VALUE},
{Double.MIN_VALUE, 0.0d},
{Double.MIN_VALUE*2, Double.MIN_VALUE},
{Double_MAX_SUBNORMAL, Double_MAX_SUBNORMALmm},
- {DoubleConsts.MIN_NORMAL, Double_MAX_SUBNORMAL},
- {DoubleConsts.MIN_NORMAL+
- Double.MIN_VALUE, DoubleConsts.MIN_NORMAL},
+ {Double.MIN_NORMAL, Double_MAX_SUBNORMAL},
+ {Double.MIN_NORMAL+
+ Double.MIN_VALUE, Double.MIN_NORMAL},
{Double.MAX_VALUE, Double_MAX_VALUEmm},
{infinityD, Double.MAX_VALUE},
};
@@ -689,7 +692,7 @@
-Float.MAX_VALUE,
-3.0f,
-1.0f,
- -FloatConsts.MIN_NORMAL,
+ -Float.MIN_NORMAL,
-Float_MAX_SUBNORMALmm,
-Float_MAX_SUBNORMAL,
-Float.MIN_VALUE,
@@ -698,7 +701,7 @@
Float.MIN_VALUE,
Float_MAX_SUBNORMALmm,
Float_MAX_SUBNORMAL,
- FloatConsts.MIN_NORMAL,
+ Float.MIN_NORMAL,
1.0f,
3.0f,
Float_MAX_VALUEmm,
@@ -739,7 +742,7 @@
-Double.MAX_VALUE,
-3.0d,
-1.0d,
- -DoubleConsts.MIN_NORMAL,
+ -Double.MIN_NORMAL,
-Double_MAX_SUBNORMALmm,
-Double_MAX_SUBNORMAL,
-Double.MIN_VALUE,
@@ -748,7 +751,7 @@
Double.MIN_VALUE,
Double_MAX_SUBNORMALmm,
Double_MAX_SUBNORMAL,
- DoubleConsts.MIN_NORMAL,
+ Double.MIN_NORMAL,
1.0d,
3.0d,
Double_MAX_VALUEmm,
@@ -790,7 +793,7 @@
Float.MIN_VALUE,
Float_MAX_SUBNORMALmm,
Float_MAX_SUBNORMAL,
- FloatConsts.MIN_NORMAL,
+ Float.MIN_NORMAL,
1.0f,
3.0f,
Float_MAX_VALUEmm,
@@ -801,7 +804,7 @@
-Float.MAX_VALUE,
-3.0f,
-1.0f,
- -FloatConsts.MIN_NORMAL,
+ -Float.MIN_NORMAL,
-Float_MAX_SUBNORMALmm,
-Float_MAX_SUBNORMAL,
-Float.MIN_VALUE,
@@ -864,7 +867,7 @@
Double.MIN_VALUE,
Double_MAX_SUBNORMALmm,
Double_MAX_SUBNORMAL,
- DoubleConsts.MIN_NORMAL,
+ Double.MIN_NORMAL,
1.0d,
3.0d,
Double_MAX_VALUEmm,
@@ -875,7 +878,7 @@
-Double.MAX_VALUE,
-3.0d,
-1.0d,
- -DoubleConsts.MIN_NORMAL,
+ -Double.MIN_NORMAL,
-Double_MAX_SUBNORMALmm,
-Double_MAX_SUBNORMAL,
-Double.MIN_VALUE,
@@ -964,8 +967,8 @@
public static int testFloatScalb() {
int failures=0;
- int MAX_SCALE = FloatConsts.MAX_EXPONENT + -FloatConsts.MIN_EXPONENT +
- FloatConsts.SIGNIFICAND_WIDTH + 1;
+ int MAX_SCALE = Float.MAX_EXPONENT + -Float.MIN_EXPONENT +
+ FloatUtils.SIGNIFICAND_WIDTH + 1;
// Arguments x, where scalb(x,n) is x for any n.
@@ -988,7 +991,7 @@
3.0f*Float.MIN_VALUE,
Float_MAX_SUBNORMALmm,
Float_MAX_SUBNORMAL,
- FloatConsts.MIN_NORMAL,
+ Float.MIN_NORMAL,
1.0f,
2.0f,
3.0f,
@@ -998,8 +1001,8 @@
};
int [] oneMultiplyScalingFactors = {
- FloatConsts.MIN_EXPONENT,
- FloatConsts.MIN_EXPONENT+1,
+ Float.MIN_EXPONENT,
+ Float.MIN_EXPONENT+1,
-3,
-2,
-1,
@@ -1007,8 +1010,8 @@
1,
2,
3,
- FloatConsts.MAX_EXPONENT-1,
- FloatConsts.MAX_EXPONENT
+ Float.MAX_EXPONENT-1,
+ Float.MAX_EXPONENT
};
int [] manyScalingFactors = {
@@ -1018,14 +1021,14 @@
-MAX_SCALE,
-MAX_SCALE+1,
- 2*FloatConsts.MIN_EXPONENT-1, // -253
- 2*FloatConsts.MIN_EXPONENT, // -252
- 2*FloatConsts.MIN_EXPONENT+1, // -251
-
- FloatConsts.MIN_EXPONENT - FloatConsts.SIGNIFICAND_WIDTH,
- FloatConsts.MIN_SUB_EXPONENT,
- -FloatConsts.MAX_EXPONENT, // -127
- FloatConsts.MIN_EXPONENT, // -126
+ 2*Float.MIN_EXPONENT-1, // -253
+ 2*Float.MIN_EXPONENT, // -252
+ 2*Float.MIN_EXPONENT+1, // -251
+
+ Float.MIN_EXPONENT - FloatUtils.SIGNIFICAND_WIDTH,
+ FloatUtils.MIN_SUB_EXPONENT,
+ -Float.MAX_EXPONENT, // -127
+ Float.MIN_EXPONENT, // -126
-2,
-1,
@@ -1033,13 +1036,13 @@
1,
2,
- FloatConsts.MAX_EXPONENT-1, // 126
- FloatConsts.MAX_EXPONENT, // 127
- FloatConsts.MAX_EXPONENT+1, // 128
-
- 2*FloatConsts.MAX_EXPONENT-1, // 253
- 2*FloatConsts.MAX_EXPONENT, // 254
- 2*FloatConsts.MAX_EXPONENT+1, // 255
+ Float.MAX_EXPONENT-1, // 126
+ Float.MAX_EXPONENT, // 127
+ Float.MAX_EXPONENT+1, // 128
+
+ 2*Float.MAX_EXPONENT-1, // 253
+ 2*Float.MAX_EXPONENT, // 254
+ 2*Float.MAX_EXPONENT+1, // 255
MAX_SCALE-1,
MAX_SCALE,
@@ -1086,7 +1089,7 @@
// Create 2^MAX_EXPONENT
float twoToTheMaxExp = 1.0f; // 2^0
- for(int i = 0; i < FloatConsts.MAX_EXPONENT; i++)
+ for(int i = 0; i < Float.MAX_EXPONENT; i++)
twoToTheMaxExp *=2.0f;
// Scale-up subnormal values until they all overflow
@@ -1094,12 +1097,12 @@
float scale = 1.0f; // 2^j
float value = subnormalTestCases[i];
- for(int j=FloatConsts.MAX_EXPONENT*2; j < MAX_SCALE; j++) { // MAX_SCALE -1 should cause overflow
+ for(int j=Float.MAX_EXPONENT*2; j < MAX_SCALE; j++) { // MAX_SCALE -1 should cause overflow
int scaleFactor = j;
failures+=testScalbCase(value,
scaleFactor,
- (Tests.ilogb(value) +j > FloatConsts.MAX_EXPONENT ) ?
+ (Tests.ilogb(value) +j > Float.MAX_EXPONENT ) ?
Math.copySign(infinityF, value) : // overflow
// calculate right answer
twoToTheMaxExp*(twoToTheMaxExp*(scale*value)) );
@@ -1172,8 +1175,8 @@
public static int testDoubleScalb() {
int failures=0;
- int MAX_SCALE = DoubleConsts.MAX_EXPONENT + -DoubleConsts.MIN_EXPONENT +
- DoubleConsts.SIGNIFICAND_WIDTH + 1;
+ int MAX_SCALE = Double.MAX_EXPONENT + -Double.MIN_EXPONENT +
+ DoubleUtils.SIGNIFICAND_WIDTH + 1;
// Arguments x, where scalb(x,n) is x for any n.
@@ -1195,7 +1198,7 @@
3.0d*Double.MIN_VALUE,
Double_MAX_SUBNORMALmm,
Double_MAX_SUBNORMAL,
- DoubleConsts.MIN_NORMAL,
+ Double.MIN_NORMAL,
1.0d,
2.0d,
3.0d,
@@ -1205,8 +1208,8 @@
};
int [] oneMultiplyScalingFactors = {
- DoubleConsts.MIN_EXPONENT,
- DoubleConsts.MIN_EXPONENT+1,
+ Double.MIN_EXPONENT,
+ Double.MIN_EXPONENT+1,
-3,
-2,
-1,
@@ -1214,8 +1217,8 @@
1,
2,
3,
- DoubleConsts.MAX_EXPONENT-1,
- DoubleConsts.MAX_EXPONENT
+ Double.MAX_EXPONENT-1,
+ Double.MAX_EXPONENT
};
int [] manyScalingFactors = {
@@ -1225,15 +1228,15 @@
-MAX_SCALE,
-MAX_SCALE+1,
- 2*DoubleConsts.MIN_EXPONENT-1, // -2045
- 2*DoubleConsts.MIN_EXPONENT, // -2044
- 2*DoubleConsts.MIN_EXPONENT+1, // -2043
-
- DoubleConsts.MIN_EXPONENT, // -1022
- DoubleConsts.MIN_EXPONENT - DoubleConsts.SIGNIFICAND_WIDTH,
- DoubleConsts.MIN_SUB_EXPONENT,
- -DoubleConsts.MAX_EXPONENT, // -1023
- DoubleConsts.MIN_EXPONENT, // -1022
+ 2*Double.MIN_EXPONENT-1, // -2045
+ 2*Double.MIN_EXPONENT, // -2044
+ 2*Double.MIN_EXPONENT+1, // -2043
+
+ Double.MIN_EXPONENT, // -1022
+ Double.MIN_EXPONENT - DoubleUtils.SIGNIFICAND_WIDTH,
+ DoubleUtils.MIN_SUB_EXPONENT,
+ -Double.MAX_EXPONENT, // -1023
+ Double.MIN_EXPONENT, // -1022
-2,
-1,
@@ -1241,13 +1244,13 @@
1,
2,
- DoubleConsts.MAX_EXPONENT-1, // 1022
- DoubleConsts.MAX_EXPONENT, // 1023
- DoubleConsts.MAX_EXPONENT+1, // 1024
-
- 2*DoubleConsts.MAX_EXPONENT-1, // 2045
- 2*DoubleConsts.MAX_EXPONENT, // 2046
- 2*DoubleConsts.MAX_EXPONENT+1, // 2047
+ Double.MAX_EXPONENT-1, // 1022
+ Double.MAX_EXPONENT, // 1023
+ Double.MAX_EXPONENT+1, // 1024
+
+ 2*Double.MAX_EXPONENT-1, // 2045
+ 2*Double.MAX_EXPONENT, // 2046
+ 2*Double.MAX_EXPONENT+1, // 2047
MAX_SCALE-1,
MAX_SCALE,
@@ -1294,7 +1297,7 @@
// Create 2^MAX_EXPONENT
double twoToTheMaxExp = 1.0; // 2^0
- for(int i = 0; i < DoubleConsts.MAX_EXPONENT; i++)
+ for(int i = 0; i < Double.MAX_EXPONENT; i++)
twoToTheMaxExp *=2.0;
// Scale-up subnormal values until they all overflow
@@ -1302,12 +1305,12 @@
double scale = 1.0; // 2^j
double value = subnormalTestCases[i];
- for(int j=DoubleConsts.MAX_EXPONENT*2; j < MAX_SCALE; j++) { // MAX_SCALE -1 should cause overflow
+ for(int j=Double.MAX_EXPONENT*2; j < MAX_SCALE; j++) { // MAX_SCALE -1 should cause overflow
int scaleFactor = j;
failures+=testScalbCase(value,
scaleFactor,
- (Tests.ilogb(value) +j > DoubleConsts.MAX_EXPONENT ) ?
+ (Tests.ilogb(value) +j > Double.MAX_EXPONENT ) ?
Math.copySign(infinityD, value) : // overflow
// calculate right answer
twoToTheMaxExp*(twoToTheMaxExp*(scale*value)) );
@@ -1345,7 +1348,7 @@
double value = 0x1.000000000000bP-1;
expected = 0x0.2000000000001P-1022;
- for(int i = 0; i < DoubleConsts.MAX_EXPONENT+2; i++) {
+ for(int i = 0; i < Double.MAX_EXPONENT+2; i++) {
failures+=testScalbCase(value,
-1024-i,
expected);
@@ -1401,7 +1404,7 @@
+16.0f,
+Float.MIN_VALUE,
+Float_MAX_SUBNORMAL,
- +FloatConsts.MIN_NORMAL,
+ +Float.MIN_NORMAL,
+Float.MAX_VALUE
};
@@ -1424,12 +1427,12 @@
// Normal exponent tests
- for(int i = FloatConsts.MIN_EXPONENT; i <= FloatConsts.MAX_EXPONENT; i++) {
+ for(int i = Float.MIN_EXPONENT; i <= Float.MAX_EXPONENT; i++) {
float expected;
// Create power of two
float po2 = powerOfTwoF(i);
- expected = Math.scalb(1.0f, i - (FloatConsts.SIGNIFICAND_WIDTH-1));
+ expected = Math.scalb(1.0f, i - (FloatUtils.SIGNIFICAND_WIDTH-1));
failures += testUlpCase(po2, expected);
@@ -1440,15 +1443,15 @@
randFloat = Float.intBitsToFloat( // Exponent
(Float.floatToIntBits(po2)&
- (~FloatConsts.SIGNIF_BIT_MASK)) |
+ (~FloatUtils.SIGNIF_BIT_MASK)) |
// Significand
(randSignif &
- FloatConsts.SIGNIF_BIT_MASK) );
+ FloatUtils.SIGNIF_BIT_MASK) );
failures += testUlpCase(randFloat, expected);
}
- if (i > FloatConsts.MIN_EXPONENT) {
+ if (i > Float.MIN_EXPONENT) {
float po2minus = Math.nextAfter(po2,
Float.NEGATIVE_INFINITY);
failures += testUlpCase(po2minus, expected/2.0f);
@@ -1468,7 +1471,7 @@
float top=Float.MIN_VALUE;
for( int i = 1;
- i < FloatConsts.SIGNIFICAND_WIDTH;
+ i < FloatUtils.SIGNIFICAND_WIDTH;
i++, top *= 2.0f) {
failures += testUlpCase(top, Float.MIN_VALUE);
@@ -1506,7 +1509,7 @@
+16.0d,
+Double.MIN_VALUE,
+Double_MAX_SUBNORMAL,
- +DoubleConsts.MIN_NORMAL,
+ +Double.MIN_NORMAL,
+Double.MAX_VALUE
};
@@ -1529,12 +1532,12 @@
// Normal exponent tests
- for(int i = DoubleConsts.MIN_EXPONENT; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = Double.MIN_EXPONENT; i <= Double.MAX_EXPONENT; i++) {
double expected;
// Create power of two
double po2 = powerOfTwoD(i);
- expected = Math.scalb(1.0, i - (DoubleConsts.SIGNIFICAND_WIDTH-1));
+ expected = Math.scalb(1.0, i - (DoubleUtils.SIGNIFICAND_WIDTH-1));
failures += testUlpCase(po2, expected);
@@ -1545,15 +1548,15 @@
randDouble = Double.longBitsToDouble( // Exponent
(Double.doubleToLongBits(po2)&
- (~DoubleConsts.SIGNIF_BIT_MASK)) |
+ (~DoubleUtils.SIGNIF_BIT_MASK)) |
// Significand
(randSignif &
- DoubleConsts.SIGNIF_BIT_MASK) );
+ DoubleUtils.SIGNIF_BIT_MASK) );
failures += testUlpCase(randDouble, expected);
}
- if (i > DoubleConsts.MIN_EXPONENT) {
+ if (i > Double.MIN_EXPONENT) {
double po2minus = Math.nextAfter(po2,
Double.NEGATIVE_INFINITY);
failures += testUlpCase(po2minus, expected/2.0f);
@@ -1573,7 +1576,7 @@
double top=Double.MIN_VALUE;
for( int i = 1;
- i < DoubleConsts.SIGNIFICAND_WIDTH;
+ i < DoubleUtils.SIGNIFICAND_WIDTH;
i++, top *= 2.0f) {
failures += testUlpCase(top, Double.MIN_VALUE);
@@ -1607,7 +1610,7 @@
{NaNf, NaNf},
{-infinityF, -1.0f},
{-Float.MAX_VALUE, -1.0f},
- {-FloatConsts.MIN_NORMAL, -1.0f},
+ {-Float.MIN_NORMAL, -1.0f},
{-1.0f, -1.0f},
{-2.0f, -1.0f},
{-Float_MAX_SUBNORMAL, -1.0f},
@@ -1617,7 +1620,7 @@
{Float.MIN_VALUE, 1.0f},
{Float_MAX_SUBNORMALmm, 1.0f},
{Float_MAX_SUBNORMAL, 1.0f},
- {FloatConsts.MIN_NORMAL, 1.0f},
+ {Float.MIN_NORMAL, 1.0f},
{1.0f, 1.0f},
{2.0f, 1.0f},
{Float_MAX_VALUEmm, 1.0f},
@@ -1641,7 +1644,7 @@
{NaNd, NaNd},
{-infinityD, -1.0},
{-Double.MAX_VALUE, -1.0},
- {-DoubleConsts.MIN_NORMAL, -1.0},
+ {-Double.MIN_NORMAL, -1.0},
{-1.0, -1.0},
{-2.0, -1.0},
{-Double_MAX_SUBNORMAL, -1.0},
@@ -1651,7 +1654,7 @@
{Double.MIN_VALUE, 1.0},
{Double_MAX_SUBNORMALmm, 1.0},
{Double_MAX_SUBNORMAL, 1.0},
- {DoubleConsts.MIN_NORMAL, 1.0},
+ {Double.MIN_NORMAL, 1.0},
{1.0, 1.0},
{2.0, 1.0},
{Double_MAX_VALUEmm, 1.0},
--- old/test/java/lang/Math/Log10Tests.java 2014-08-15 13:26:15.000000000 +0800
+++ new/test/java/lang/Math/Log10Tests.java 2014-08-15 13:26:15.000000000 +0800
@@ -25,11 +25,12 @@
* @test
* @bug 4074599 4939441
* @summary Tests for {Math, StrictMath}.log10
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main Log10Tests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
-
public class Log10Tests {
private Log10Tests(){}
@@ -70,7 +71,7 @@
{Double.NEGATIVE_INFINITY, NaNd},
{-8.0, NaNd},
{-1.0, NaNd},
- {-DoubleConsts.MIN_NORMAL, NaNd},
+ {-Double.MIN_NORMAL, NaNd},
{-Double.MIN_VALUE, NaNd},
{-0.0, -infinityD},
{+0.0, -infinityD},
--- old/test/java/lang/Math/Log1pTests.java 2014-08-15 13:26:15.000000000 +0800
+++ new/test/java/lang/Math/Log1pTests.java 2014-08-15 13:26:15.000000000 +0800
@@ -25,10 +25,13 @@
* @test
* @bug 4851638 4939441
* @summary Tests for {Math, StrictMath}.log1p
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main Log1pTests
* @author Joseph D. Darcy
*/
-import sun.misc.DoubleConsts;
+import static jdk.testlibrary.DoubleUtils.*;
public class Log1pTests {
private Log1pTests(){}
@@ -86,14 +89,14 @@
}
// For |x| < 2^-54 log1p(x) ~= x
- for(int i = DoubleConsts.MIN_SUB_EXPONENT; i <= -54; i++) {
+ for(int i = MIN_SUB_EXPONENT; i <= -54; i++) {
double d = Math.scalb(2, i);
failures += testLog1pCase(d, d);
failures += testLog1pCase(-d, -d);
}
// For x > 2^53 log1p(x) ~= log(x)
- for(int i = 53; i <= DoubleConsts.MAX_EXPONENT; i++) {
+ for(int i = 53; i <= Double.MAX_EXPONENT; i++) {
double d = Math.scalb(2, i);
failures += testLog1pCaseWithUlpDiff(d, StrictMath.log(d), 2.001);
}
--- old/test/java/lang/Math/PowTests.java 2014-08-15 13:26:16.000000000 +0800
+++ new/test/java/lang/Math/PowTests.java 2014-08-15 13:26:16.000000000 +0800
@@ -25,6 +25,9 @@
* @test
* @bug 4984407 5033578
* @summary Tests for {Math, StrictMath}.pow
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main PowTests
* @author Joseph D. Darcy
*/
--- old/test/java/lang/Math/Rint.java 2014-08-15 13:26:17.000000000 +0800
+++ new/test/java/lang/Math/Rint.java 2014-08-15 13:26:17.000000000 +0800
@@ -25,10 +25,11 @@
* @test
* @bug 4101566 4831589
* @summary Check for correct implementation of Math.rint(double)
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main Rint
*/
-import sun.misc.DoubleConsts;
-
public class Rint {
static int testRintCase(double input, double expected) {
@@ -51,8 +52,8 @@
double [][] testCases = {
{0.0, 0.0},
{Double.MIN_VALUE, 0.0},
- {Math.nextDown(DoubleConsts.MIN_NORMAL), 0.0},
- {DoubleConsts.MIN_NORMAL, 0.0},
+ {Math.nextDown(Double.MIN_NORMAL), 0.0},
+ {Double.MIN_NORMAL, 0.0},
{0.2, 0.0},
--- old/test/java/lang/Math/RoundTests.java 2014-08-15 13:26:17.000000000 +0800
+++ new/test/java/lang/Math/RoundTests.java 2014-08-15 13:26:17.000000000 +0800
@@ -25,6 +25,9 @@
* @test
* @bug 6430675 8010430
* @summary Check for correct implementation of {Math, StrictMath}.round
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main RoundTests
*/
public class RoundTests {
public static void main(String... args) {
--- old/test/java/lang/Math/TanTests.java 2014-08-15 13:26:18.000000000 +0800
+++ new/test/java/lang/Math/TanTests.java 2014-08-15 13:26:18.000000000 +0800
@@ -25,6 +25,9 @@
* @test
* @bug 5033578
* @summary Tests for {Math, StrictMath}.tan
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main TanTests
* @author Joseph D. Darcy
*/
--- old/test/java/lang/Math/Tests.java 2014-08-15 13:26:19.000000000 +0800
+++ new/test/java/lang/Math/Tests.java 2014-08-15 13:26:18.000000000 +0800
@@ -30,8 +30,8 @@
* and finally the expected result.
*/
-import sun.misc.FloatConsts;
-import sun.misc.DoubleConsts;
+import jdk.testlibrary.DoubleUtils;
+import jdk.testlibrary.FloatUtils;
public class Tests {
private Tests(){}; // do not instantiate
@@ -81,13 +81,13 @@
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)
}
@@ -103,7 +103,7 @@
*/
// 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
@@ -111,20 +111,20 @@
// 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;
}
}
@@ -150,13 +150,13 @@
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)
}
@@ -172,7 +172,7 @@
*/
// 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
@@ -180,20 +180,20 @@
// 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;
}
}
--- old/test/java/lang/Math/WorstCaseTests.java 2014-08-15 13:26:19.000000000 +0800
+++ new/test/java/lang/Math/WorstCaseTests.java 2014-08-15 13:26:19.000000000 +0800
@@ -25,8 +25,8 @@
* @test
* @bug 4900206
* @summary Test worst case behavior of exp, log, sin, cos, etc.
- * @build Tests
- * @build WorstCaseTests
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
* @run main WorstCaseTests
* @run main/othervm -Xcomp WorstCaseTests
* @author Joseph D. Darcy
--- old/test/java/util/Formatter/BasicDouble.java 2014-08-15 13:26:20.000000000 +0800
+++ new/test/java/util/Formatter/BasicDouble.java 2014-08-15 13:26:20.000000000 +0800
@@ -36,9 +36,6 @@
import java.text.DateFormatSymbols;
import java.util.*;
-import sun.misc.DoubleConsts;
-
-
import static java.util.Calendar.*;
@@ -1313,12 +1310,12 @@
test("%.1a", "-0x1.0p0", -1.0);
test("%.11a", "0x1.80000000000p1", 3.0);
test("%.1a", "0x1.8p1", 3.0);
- test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
- test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
+ test("%.11a", "0x1.00000000000p-1022", Double.MIN_NORMAL);
+ test("%.1a", "0x1.0p-1022", Double.MIN_NORMAL);
test("%.11a", "0x1.00000000000p-1022",
- Math.nextDown(DoubleConsts.MIN_NORMAL));
+ Math.nextDown(Double.MIN_NORMAL));
test("%.1a", "0x1.0p-1022",
- Math.nextDown(DoubleConsts.MIN_NORMAL));
+ Math.nextDown(Double.MIN_NORMAL));
test("%.11a", "0x1.ffffffffffep-1023", 0x0.fffffffffffp-1022);
test("%.1a", "0x1.0p-1022", 0x0.fffffffffffp-1022);
test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE);
--- old/test/sun/misc/FloatingDecimal/OldFloatingDecimalForTest.java 2014-08-15 13:26:20.000000000 +0800
+++ new/test/sun/misc/FloatingDecimal/OldFloatingDecimalForTest.java 2014-08-15 13:26:20.000000000 +0800
@@ -23,8 +23,8 @@
//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{
@@ -2217,12 +2217,12 @@
// 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
@@ -2236,15 +2236,15 @@
// 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.
@@ -2266,7 +2266,7 @@
// -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:
@@ -2282,11 +2282,11 @@
// 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);
}
}
@@ -2349,8 +2349,8 @@
* 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.
--- old/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java 2014-08-15 13:26:21.000000000 +0800
+++ new/test/sun/misc/FloatingDecimal/TestFloatingDecimal.java 2014-08-15 13:26:21.000000000 +0800
@@ -58,6 +58,9 @@
* @test
* @bug 7032154
* @summary unit tests of sun.misc.FloatingDecimal
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
+ * @run main TestFloatingDecimal
* @author Brian Burkhalter
*/
public class TestFloatingDecimal {
--- /dev/null 2014-08-15 13:26:22.000000000 +0800
+++ new/test/lib/testlibrary/jdk/testlibrary/DoubleUtils.java 2014-08-15 13:26:22.000000000 +0800
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+/**
+ * Common library for additional constants of the Double
type.
+ */
+public final class DoubleUtils {
+
+ /**
+ * Bias used in representing a Double
exponent.
+ */
+ public static final int EXP_BIAS = 1023;
+
+ /**
+ * Bit mask to isolate the exponent field of a
+ * Double
.
+ */
+ public static final long EXP_BIT_MASK = 0x7FF0000000000000L;
+
+ /**
+ * Bit mask to isolate the sign bit of a Double
.
+ */
+ public static final long SIGN_BIT_MASK = 0x8000000000000000L;
+
+ /**
+ * Bit mask to isolate the significand field of a
+ * Double
.
+ */
+ public static final long SIGNIF_BIT_MASK = 0x000FFFFFFFFFFFFFL;
+
+ /**
+ * The number of logical bits in the significand of a
+ * Double
number, including the implicit bit.
+ */
+ public static final int SIGNIFICAND_WIDTH = 53;
+
+ /**
+ * The exponent the smallest positive Double
+ * subnormal value would have if it could be normalized..
+ */
+ public static final int MIN_SUB_EXPONENT = Double.MIN_EXPONENT -
+ (SIGNIFICAND_WIDTH - 1);
+
+}
--- /dev/null 2014-08-15 13:26:23.000000000 +0800
+++ new/test/lib/testlibrary/jdk/testlibrary/FloatUtils.java 2014-08-15 13:26:22.000000000 +0800
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+/**
+ * Common library for additional constants of the Float
type.
+ */
+public final class FloatUtils {
+
+ /**
+ * Bias used in representing a Float
exponent.
+ */
+ public static final int EXP_BIAS = 127;
+
+ /**
+ * Bit mask to isolate the exponent field of a
+ * Float
.
+ */
+ public static final int EXP_BIT_MASK = 0x7F800000;
+
+ /**
+ * Bit mask to isolate the sign bit of a Float
.
+ */
+ public static final int SIGN_BIT_MASK = 0x80000000;
+
+ /**
+ * Bit mask to isolate the significand field of a
+ * Float
.
+ */
+ public static final int SIGNIF_BIT_MASK = 0x007FFFFF;
+
+ /**
+ * The number of logical bits in the significand of a
+ * Float
number, including the implicit bit.
+ */
+ public static final int SIGNIFICAND_WIDTH = 24;
+
+ /**
+ * The exponent the smallest positive Float
subnormal
+ * value would have if it could be normalized.
+ */
+ public static final int MIN_SUB_EXPONENT = Float.MIN_EXPONENT -
+ (SIGNIFICAND_WIDTH - 1);
+
+}