--- a/jdk/src/share/classes/java/lang/Double.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/src/share/classes/java/lang/Double.java Wed Sep 21 23:22:11 2011 -0700
@@ -276,7 +276,7 @@
* 7.19.6.1; however, the output of this method is more
* tightly specified.
*/
- if (!FpUtils.isFinite(d) )
+ if (!isFinite(d) )
// For infinity and NaN, use the decimal output.
return Double.toString(d);
else {
@@ -548,7 +548,7 @@
* @return {@code true} if the value of the argument is NaN;
* {@code false} otherwise.
*/
- static public boolean isNaN(double v) {
+ public static boolean isNaN(double v) {
return (v != v);
}
@@ -560,11 +560,25 @@
* @return {@code true} if the value of the argument is positive
* infinity or negative infinity; {@code false} otherwise.
*/
- static public boolean isInfinite(double v) {
+ public static boolean isInfinite(double v) {
return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
}
/**
+ * Returns {@code true} if the argument is a finite floating-point
+ * value; returns {@code false} otherwise (for NaN and infinity
+ * arguments).
+ *
+ * @param d the {@code double} value to be tested
+ * @return {@code true} if the argument is a finite
+ * floating-point value, {@code false} otherwise.
+ * @since 1.8
+ */
+ public static boolean isFinite(double d) {
+ return Math.abs(d) <= DoubleConsts.MAX_VALUE;
+ }
+
+ /**
* The value of the Double.
*
* @serial
--- a/jdk/src/share/classes/java/lang/Float.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/src/share/classes/java/lang/Float.java Wed Sep 21 23:22:11 2011 -0700
@@ -459,7 +459,7 @@
* @return {@code true} if the argument is NaN;
* {@code false} otherwise.
*/
- static public boolean isNaN(float v) {
+ public static boolean isNaN(float v) {
return (v != v);
}
@@ -471,10 +471,25 @@
* @return {@code true} if the argument is positive infinity or
* negative infinity; {@code false} otherwise.
*/
- static public boolean isInfinite(float v) {
+ public static boolean isInfinite(float v) {
return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
}
+
+ /**
+ * Returns {@code true} if the argument is a finite floating-point
+ * value; returns {@code false} otherwise (for NaN and infinity
+ * arguments).
+ *
+ * @param f the {@code float} value to be tested
+ * @return {@code true} if the argument is a finite
+ * floating-point value, {@code false} otherwise.
+ * @since 1.8
+ */
+ public static boolean isFinite(float f) {
+ return Math.abs(f) <= FloatConsts.MAX_VALUE;
+ }
+
/**
* The value of the Float.
*
--- a/jdk/src/share/classes/java/lang/Math.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/src/share/classes/java/lang/Math.java Wed Sep 21 23:22:11 2011 -0700
@@ -1649,6 +1649,79 @@
}
}
+ /**
+ * Returns the floating-point value adjacent to {@code d} in
+ * the direction of negative infinity. This method is
+ * semantically equivalent to {@code nextAfter(d,
+ * Double.NEGATIVE_INFINITY)}; however, a
+ * {@code nextDown} implementation may run faster than its
+ * equivalent {@code nextAfter} call.
+ *
+ * <p>Special Cases:
+ * <ul>
+ * <li> If the argument is NaN, the result is NaN.
+ *
+ * <li> If the argument is negative infinity, the result is
+ * negative infinity.
+ *
+ * <li> If the argument is zero, the result is
+ * {@code -Double.MIN_VALUE}
+ *
+ * </ul>
+ *
+ * @param d starting floating-point value
+ * @return The adjacent floating-point value closer to negative
+ * infinity.
+ * @since 1.8
+ */
+ public static double nextDown(double d) {
+ if (Double.isNaN(d) || d == Double.NEGATIVE_INFINITY)
+ return d;
+ else {
+ if (d == 0.0)
+ return -Double.MIN_VALUE;
+ else
+ return Double.longBitsToDouble(Double.doubleToRawLongBits(d) +
+ ((d > 0.0d)?-1L:+1L));
+ }
+ }
+
+ /**
+ * Returns the floating-point value adjacent to {@code f} in
+ * the direction of negative infinity. This method is
+ * semantically equivalent to {@code nextAfter(f,
+ * Float.NEGATIVE_INFINITY)}; however, a
+ * {@code nextDown} implementation may run faster than its
+ * equivalent {@code nextAfter} call.
+ *
+ * <p>Special Cases:
+ * <ul>
+ * <li> If the argument is NaN, the result is NaN.
+ *
+ * <li> If the argument is negative infinity, the result is
+ * negative infinity.
+ *
+ * <li> If the argument is zero, the result is
+ * {@code -Float.MIN_VALUE}
+ *
+ * </ul>
+ *
+ * @param f starting floating-point value
+ * @return The adjacent floating-point value closer to negative
+ * infinity.
+ * @since 1.8
+ */
+ public static float nextDown(float f) {
+ if (Float.isNaN(f) || f == Float.NEGATIVE_INFINITY)
+ return f;
+ else {
+ if (f == 0.0f)
+ return -Float.MIN_VALUE;
+ else
+ return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
+ ((f > 0.0f)?-1:+1));
+ }
+ }
/**
* Return {@code d} ×
--- a/jdk/src/share/classes/java/lang/StrictMath.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/src/share/classes/java/lang/StrictMath.java Wed Sep 21 23:22:11 2011 -0700
@@ -1397,6 +1397,64 @@
}
/**
+ * Returns the floating-point value adjacent to {@code d} in
+ * the direction of negative infinity. This method is
+ * semantically equivalent to {@code nextAfter(d,
+ * Double.NEGATIVE_INFINITY)}; however, a
+ * {@code nextDown} implementation may run faster than its
+ * equivalent {@code nextAfter} call.
+ *
+ * <p>Special Cases:
+ * <ul>
+ * <li> If the argument is NaN, the result is NaN.
+ *
+ * <li> If the argument is negative infinity, the result is
+ * negative infinity.
+ *
+ * <li> If the argument is zero, the result is
+ * {@code -Double.MIN_VALUE}
+ *
+ * </ul>
+ *
+ * @param d starting floating-point value
+ * @return The adjacent floating-point value closer to negative
+ * infinity.
+ * @since 1.8
+ */
+ public static double nextDown(double d) {
+ return Math.nextDown(d);
+ }
+
+ /**
+ * Returns the floating-point value adjacent to {@code f} in
+ * the direction of negative infinity. This method is
+ * semantically equivalent to {@code nextAfter(f,
+ * Float.NEGATIVE_INFINITY)}; however, a
+ * {@code nextDown} implementation may run faster than its
+ * equivalent {@code nextAfter} call.
+ *
+ * <p>Special Cases:
+ * <ul>
+ * <li> If the argument is NaN, the result is NaN.
+ *
+ * <li> If the argument is negative infinity, the result is
+ * negative infinity.
+ *
+ * <li> If the argument is zero, the result is
+ * {@code -Float.MIN_VALUE}
+ *
+ * </ul>
+ *
+ * @param f starting floating-point value
+ * @return The adjacent floating-point value closer to negative
+ * infinity.
+ * @since 1.8
+ */
+ public static float nextDown(float f) {
+ return Math.nextDown(f);
+ }
+
+ /**
* Return {@code d} ×
* 2<sup>{@code scaleFactor}</sup> rounded as if performed
* by a single correctly rounded floating-point multiply to a
--- a/jdk/src/share/classes/java/util/Formatter.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/src/share/classes/java/util/Formatter.java Wed Sep 21 23:22:11 2011 -0700
@@ -50,7 +50,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
import sun.misc.FormattedFloatingDecimal;
@@ -3417,7 +3416,7 @@
// Method assumes that d > 0.
private String hexDouble(double d, int prec) {
// Let Double.toHexString handle simple cases
- if(!FpUtils.isFinite(d) || d == 0.0 || prec == 0 || prec >= 13)
+ if(!Double.isFinite(d) || d == 0.0 || prec == 0 || prec >= 13)
// remove "0x"
return Double.toHexString(d).substring(2);
else {
--- a/jdk/src/share/classes/sun/misc/FpUtils.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/src/share/classes/sun/misc/FpUtils.java Wed Sep 21 23:22:11 2011 -0700
@@ -202,9 +202,11 @@
* @param d the {@code double} value to be tested
* @return {@code true} if the argument is a finite
* floating-point value, {@code false} otherwise.
+ * @deprecated Use Double.isFinite.
*/
+ @Deprecated
public static boolean isFinite(double d) {
- return Math.abs(d) <= DoubleConsts.MAX_VALUE;
+ return Double.isFinite(d);
}
/**
@@ -215,9 +217,11 @@
* @param f the {@code float} value to be tested
* @return {@code true} if the argument is a finite
* floating-point value, {@code false} otherwise.
+ * @deprecated Use Float.isFinite.
*/
+ @Deprecated
public static boolean isFinite(float f) {
- return Math.abs(f) <= FloatConsts.MAX_VALUE;
+ return Float.isFinite(f);
}
/**
@@ -746,17 +750,11 @@
* @return The adjacent floating-point value closer to negative
* infinity.
* @author Joseph D. Darcy
+ * @deprecated Use Math.nextDown.
*/
+ @Deprecated
public static double nextDown(double d) {
- if( isNaN(d) || d == Double.NEGATIVE_INFINITY)
- return d;
- else {
- if (d == 0.0)
- return -Double.MIN_VALUE;
- else
- return Double.longBitsToDouble(Double.doubleToRawLongBits(d) +
- ((d > 0.0d)?-1L:+1L));
- }
+ return Math.nextDown(d);
}
/**
@@ -783,17 +781,11 @@
* @return The adjacent floating-point value closer to negative
* infinity.
* @author Joseph D. Darcy
+ * @deprecated Use Math.nextDown.
*/
+ @Deprecated
public static double nextDown(float f) {
- if( isNaN(f) || f == Float.NEGATIVE_INFINITY)
- return f;
- else {
- if (f == 0.0f)
- return -Float.MIN_VALUE;
- else
- return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
- ((f > 0.0f)?-1:+1));
- }
+ return Math.nextDown(f);
}
/**
--- a/jdk/test/java/lang/Double/ParseHexFloatingPoint.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Double/ParseHexFloatingPoint.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -30,7 +30,6 @@
import java.util.regex.*;
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
public class ParseHexFloatingPoint {
@@ -227,7 +226,7 @@
new PairSD("0x1.000000000000001p-1075", Double.MIN_VALUE),
// More subnormal rounding tests
- new PairSD("0x0.fffffffffffff7fffffp-1022", FpUtils.nextDown(DoubleConsts.MIN_NORMAL)),
+ 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),
@@ -242,10 +241,10 @@
new PairSD("0x1.fffffffffffff8p1023", infinityD),
new PairSD("0x1.fffffffffffff8000001p1023", infinityD),
- new PairSD("0x1.ffffffffffffep1023", FpUtils.nextDown(Double.MAX_VALUE)),
- new PairSD("0x1.ffffffffffffe0000p1023", FpUtils.nextDown(Double.MAX_VALUE)),
- new PairSD("0x1.ffffffffffffe8p1023", FpUtils.nextDown(Double.MAX_VALUE)),
- new PairSD("0x1.ffffffffffffe7p1023", FpUtils.nextDown(Double.MAX_VALUE)),
+ new PairSD("0x1.ffffffffffffep1023", Math.nextDown(Double.MAX_VALUE)),
+ new PairSD("0x1.ffffffffffffe0000p1023", Math.nextDown(Double.MAX_VALUE)),
+ new PairSD("0x1.ffffffffffffe8p1023", Math.nextDown(Double.MAX_VALUE)),
+ new PairSD("0x1.ffffffffffffe7p1023", Math.nextDown(Double.MAX_VALUE)),
new PairSD("0x1.ffffffffffffeffffffp1023", Double.MAX_VALUE),
new PairSD("0x1.ffffffffffffe8000001p1023", Double.MAX_VALUE),
};
@@ -284,8 +283,8 @@
};
double [] answers = {
- FpUtils.nextDown(FpUtils.nextDown(2.0)),
- FpUtils.nextDown(2.0),
+ Math.nextDown(Math.nextDown(2.0)),
+ Math.nextDown(2.0),
2.0
};
--- a/jdk/test/java/lang/Math/CeilAndFloorTests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/CeilAndFloorTests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
@@ -27,7 +27,6 @@
* @summary Check for correct implementation of Math.ceil and Math.floor
*/
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
public class CeilAndFloorTests {
@@ -69,7 +68,7 @@
for(int i = Double.MIN_EXPONENT; i <= Double.MAX_EXPONENT; i++) {
double powerOfTwo = Math.scalb(1.0, i);
- double neighborDown = FpUtils.nextDown(powerOfTwo);
+ double neighborDown = Math.nextDown(powerOfTwo);
double neighborUp = Math.nextUp(powerOfTwo);
if (i < 0) {
@@ -114,7 +113,7 @@
for(int i = -(0x10000); i <= 0x10000; i++) {
double d = (double) i;
- double neighborDown = FpUtils.nextDown(d);
+ double neighborDown = Math.nextDown(d);
double neighborUp = Math.nextUp(d);
failures += testCeilCase( d, d);
@@ -140,8 +139,8 @@
double [][] testCases = {
{ Double.MIN_VALUE, 1.0},
{-Double.MIN_VALUE, -0.0},
- { FpUtils.nextDown(DoubleConsts.MIN_NORMAL), 1.0},
- {-FpUtils.nextDown(DoubleConsts.MIN_NORMAL), -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},
@@ -157,8 +156,8 @@
{ 2.5, 3.0},
{-2.5, -2.0},
- { FpUtils.nextDown(1.0), 1.0},
- { FpUtils.nextDown(-1.0), -1.0},
+ { Math.nextDown(1.0), 1.0},
+ { Math.nextDown(-1.0), -1.0},
{ Math.nextUp(1.0), 2.0},
{ Math.nextUp(-1.0), -0.0},
@@ -166,17 +165,17 @@
{ 0x1.0p51, 0x1.0p51},
{-0x1.0p51, -0x1.0p51},
- { FpUtils.nextDown(0x1.0p51), 0x1.0p51},
+ { Math.nextDown(0x1.0p51), 0x1.0p51},
{-Math.nextUp(0x1.0p51), -0x1.0p51},
{ Math.nextUp(0x1.0p51), 0x1.0p51+1},
- {-FpUtils.nextDown(0x1.0p51), -0x1.0p51+1},
+ {-Math.nextDown(0x1.0p51), -0x1.0p51+1},
- { FpUtils.nextDown(0x1.0p52), 0x1.0p52},
+ { Math.nextDown(0x1.0p52), 0x1.0p52},
{-Math.nextUp(0x1.0p52), -0x1.0p52-1.0},
{ Math.nextUp(0x1.0p52), 0x1.0p52+1.0},
- {-FpUtils.nextDown(0x1.0p52), -0x1.0p52+1.0},
+ {-Math.nextDown(0x1.0p52), -0x1.0p52+1.0},
};
for(double[] testCase : testCases) {
--- a/jdk/test/java/lang/Math/CubeRootTests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/CubeRootTests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011 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
@@ -28,7 +28,6 @@
* @author Joseph D. Darcy
*/
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
public class CubeRootTests {
@@ -245,8 +244,8 @@
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
- pcNeighbors[1] = FpUtils.nextDown(pc);
- pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
+ pcNeighbors[1] = Math.nextDown(pc);
+ pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
@@ -284,8 +283,8 @@
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
- pcNeighbors[1] = FpUtils.nextDown(pc);
- pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
+ pcNeighbors[1] = Math.nextDown(pc);
+ pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
--- a/jdk/test/java/lang/Math/Expm1Tests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/Expm1Tests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011 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
@@ -29,7 +29,6 @@
*/
import sun.misc.DoubleConsts;
-import sun.misc.FpUtils;
/*
* The Taylor expansion of expxm1(x) = exp(x) -1 is
@@ -143,8 +142,8 @@
double pc = StrictMath.log(2)*i;
pcNeighbors[2] = pc;
- pcNeighbors[1] = FpUtils.nextDown(pc);
- pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
+ pcNeighbors[1] = Math.nextDown(pc);
+ pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
--- a/jdk/test/java/lang/Math/HyperbolicTests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/HyperbolicTests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011 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
@@ -29,7 +29,6 @@
*/
import sun.misc.DoubleConsts;
-import sun.misc.FpUtils;
public class HyperbolicTests {
private HyperbolicTests(){}
@@ -280,7 +279,7 @@
long trans22 = Double.doubleToLongBits(22.0);
// (approximately) largest value such that exp shouldn't
// overflow
- long transExpOvfl = Double.doubleToLongBits(FpUtils.nextDown(709.7827128933841));
+ long transExpOvfl = Double.doubleToLongBits(Math.nextDown(709.7827128933841));
for(long i = trans22;
i < transExpOvfl;
@@ -639,7 +638,7 @@
long trans22 = Double.doubleToLongBits(22.0);
// (approximately) largest value such that exp shouldn't
// overflow
- long transExpOvfl = Double.doubleToLongBits(FpUtils.nextDown(709.7827128933841));
+ long transExpOvfl = Double.doubleToLongBits(Math.nextDown(709.7827128933841));
for(long i = trans22;
i < transExpOvfl;
--- a/jdk/test/java/lang/Math/HypotTests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/HypotTests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -156,8 +156,8 @@
double pc = Math.scalb(1.0, i);
pcNeighbors[2] = pc;
- pcNeighbors[1] = FpUtils.nextDown(pc);
- pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
+ pcNeighbors[1] = Math.nextDown(pc);
+ pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
--- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -623,8 +623,11 @@
};
for(int i = 0; i < testCases.length; i++) {
- failures+=Tests.test("FpUtils.nextDown(float)",
- testCases[i][0], FpUtils.nextDown(testCases[i][0]), testCases[i][1]);
+ failures+=Tests.test("Math.nextDown(float)",
+ testCases[i][0], Math.nextDown(testCases[i][0]), testCases[i][1]);
+
+ failures+=Tests.test("StrictMath.nextDown(float)",
+ testCases[i][0], StrictMath.nextDown(testCases[i][0]), testCases[i][1]);
}
return failures;
@@ -659,8 +662,11 @@
};
for(int i = 0; i < testCases.length; i++) {
- failures+=Tests.test("FpUtils.nextDown(double)",
- testCases[i][0], FpUtils.nextDown(testCases[i][0]), testCases[i][1]);
+ failures+=Tests.test("Math.nextDown(double)",
+ testCases[i][0], Math.nextDown(testCases[i][0]), testCases[i][1]);
+
+ failures+=Tests.test("StrictMath.nextDown(double)",
+ testCases[i][0], StrictMath.nextDown(testCases[i][0]), testCases[i][1]);
}
return failures;
@@ -706,8 +712,8 @@
FpUtils.isNaN(testCases[i]), (i ==0));
// isFinite
- failures+=Tests.test("FpUtils.isFinite(float)", testCases[i],
- FpUtils.isFinite(testCases[i]), (i >= 3));
+ failures+=Tests.test("Float.isFinite(float)", testCases[i],
+ Float.isFinite(testCases[i]), (i >= 3));
// isInfinite
failures+=Tests.test("FpUtils.isInfinite(float)", testCases[i],
@@ -756,8 +762,8 @@
FpUtils.isNaN(testCases[i]), (i ==0));
// isFinite
- failures+=Tests.test("FpUtils.isFinite(double)", testCases[i],
- FpUtils.isFinite(testCases[i]), (i >= 3));
+ failures+=Tests.test("Double.isFinite(double)", testCases[i],
+ Double.isFinite(testCases[i]), (i >= 3));
// isInfinite
failures+=Tests.test("FpUtils.isInfinite(double)", testCases[i],
--- a/jdk/test/java/lang/Math/Log10Tests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/Log10Tests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011 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
@@ -28,7 +28,6 @@
* @author Joseph D. Darcy
*/
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
public class Log10Tests {
@@ -98,13 +97,13 @@
// within a few ulps of log(x)/log(10)
for(int i = 0; i < 10000; i++) {
double input = Double.longBitsToDouble(rand.nextLong());
- if(! FpUtils.isFinite(input))
+ if(! Double.isFinite(input))
continue; // avoid testing NaN and infinite values
else {
input = Math.abs(input);
double expected = StrictMath.log(input)/LN_10;
- if( ! FpUtils.isFinite(expected))
+ if( ! Double.isFinite(expected))
continue; // if log(input) overflowed, try again
else {
double result;
@@ -154,15 +153,15 @@
if (i == 0) {
input[half] = 1.0;
up = Math.nextUp(1.0);
- down = FpUtils.nextDown(1.0);
+ down = Math.nextDown(1.0);
} else {
input[half + i] = up;
input[half - i] = down;
up = Math.nextUp(up);
- down = FpUtils.nextDown(down);
+ down = Math.nextDown(down);
}
}
- input[0] = FpUtils.nextDown(input[1]);
+ input[0] = Math.nextDown(input[1]);
for(int i = 0; i < neighbors.length; i++) {
neighbors[i] = Math.log10(input[i]);
--- a/jdk/test/java/lang/Math/Log1pTests.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/Log1pTests.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011 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
@@ -135,8 +135,8 @@
double pc = StrictMath.pow(Math.E, i) - 1;
pcNeighbors[2] = pc;
- pcNeighbors[1] = FpUtils.nextDown(pc);
- pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
+ pcNeighbors[1] = Math.nextDown(pc);
+ pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
@@ -202,5 +202,4 @@
throw new RuntimeException();
}
}
-
}
--- a/jdk/test/java/lang/Math/Rint.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/lang/Math/Rint.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -25,10 +25,8 @@
* @test
* @bug 4101566 4831589
* @summary Check for correct implementation of Math.rint(double)
- *
*/
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
public class Rint {
@@ -53,22 +51,22 @@
double [][] testCases = {
{0.0, 0.0},
{Double.MIN_VALUE, 0.0},
- {FpUtils.nextDown(DoubleConsts.MIN_NORMAL), 0.0},
+ {Math.nextDown(DoubleConsts.MIN_NORMAL), 0.0},
{DoubleConsts.MIN_NORMAL, 0.0},
{0.2, 0.0},
- {FpUtils.nextDown(0.5), 0.0},
- { 0.5, 0.0},
+ {Math.nextDown(0.5), 0.0},
+ { 0.5, 0.0},
{ Math.nextUp(0.5), 1.0},
{0.7, 1.0},
- {FpUtils.nextDown(1.0), 1.0},
- { 1.0, 1.0},
+ {Math.nextDown(1.0), 1.0},
+ { 1.0, 1.0},
{ Math.nextUp(1.0), 1.0},
- {FpUtils.nextDown(1.5), 1.0},
- { 1.5, 2.0},
+ {Math.nextDown(1.5), 1.0},
+ { 1.5, 2.0},
{ Math.nextUp(1.5), 2.0},
{4.2, 4.0},
@@ -82,7 +80,7 @@
{150000.75, 150001.0},
{300000.5, 300000.0},
{Math.nextUp(300000.5), 300001.0},
- {FpUtils.nextDown(300000.75), 300001.0},
+ {Math.nextDown(300000.75), 300001.0},
{300000.75, 300001.0},
{Math.nextUp(300000.75), 300001.0},
{300000.99, 300001.0},
@@ -91,7 +89,7 @@
{524287.75, 524288.0}, //(2^19 -1) + 0.75
{524288.75, 524289.0},
- {FpUtils.nextDown(twoToThe52), twoToThe52},
+ {Math.nextDown(twoToThe52), twoToThe52},
{twoToThe52, twoToThe52},
{Math.nextUp(twoToThe52), Math.nextUp(twoToThe52)},
@@ -118,5 +116,4 @@
throw new RuntimeException();
}
}
-
}
--- a/jdk/test/java/util/Formatter/Basic-X.java.template Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/Basic-X.java.template Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -36,7 +36,6 @@
import java.text.DateFormatSymbols;
import java.util.*;
#if[double]
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
#end[double]
@@ -1301,9 +1300,9 @@
test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
test("%.11a", "0x1.00000000000p-1022",
- FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+ Math.nextDown(DoubleConsts.MIN_NORMAL));
test("%.1a", "0x1.0p-1022",
- FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+ Math.nextDown(DoubleConsts.MIN_NORMAL));
test("%.11a", "0x1.ffffffffffep-1023",
Double.parseDouble("0x0.fffffffffffp-1022"));
test("%.1a", "0x1.0p-1022",
--- a/jdk/test/java/util/Formatter/BasicBigDecimal.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicBigDecimal.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicBigInteger.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicBigInteger.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicBoolean.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicBoolean.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicBooleanObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicBooleanObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicByte.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicByte.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicByteObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicByteObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicChar.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicChar.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicCharObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicCharObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicDateTime.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicDateTime.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
import static java.util.SimpleTimeZone.*;
--- a/jdk/test/java/util/Formatter/BasicDouble.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicDouble.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -36,7 +36,6 @@
import java.text.DateFormatSymbols;
import java.util.*;
-import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
@@ -1301,9 +1300,9 @@
test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
test("%.11a", "0x1.00000000000p-1022",
- FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+ Math.nextDown(DoubleConsts.MIN_NORMAL));
test("%.1a", "0x1.0p-1022",
- FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+ Math.nextDown(DoubleConsts.MIN_NORMAL));
test("%.11a", "0x1.ffffffffffep-1023",
Double.parseDouble("0x0.fffffffffffp-1022"));
test("%.1a", "0x1.0p-1022",
--- a/jdk/test/java/util/Formatter/BasicDoubleObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicDoubleObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicFloat.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicFloat.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicFloatObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicFloatObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicInt.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicInt.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicIntObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicIntObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicLong.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicLong.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicLongObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicLongObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicShort.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicShort.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;
--- a/jdk/test/java/util/Formatter/BasicShortObject.java Thu Sep 22 12:05:26 2011 +0800
+++ b/jdk/test/java/util/Formatter/BasicShortObject.java Wed Sep 21 23:22:11 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -39,7 +39,6 @@
-
import static java.util.Calendar.*;