test/java/lang/Math/HypotTests.java
Print this page
*** 26,37 ****
* @bug 4851638 4939441
* @summary Tests for {Math, StrictMath}.hypot
* @author Joseph D. Darcy
*/
- import sun.misc.DoubleConsts;
-
public class HypotTests {
private HypotTests(){}
static final double infinityD = Double.POSITIVE_INFINITY;
static final double NaNd = Double.NaN;
--- 26,35 ----
*** 84,95 ****
testCases[i][2]);
}
// 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;
i++) {
double input = Math.scalb(2, i);
failures += testHypotCase(input, 0.0, input);
}
--- 82,93 ----
testCases[i][2]);
}
// Verify hypot(x, 0.0) is close to x over the entire exponent
// range.
! for(int i = DoubleUtils.MIN_SUB_EXPONENT;
! i <= Double.MAX_EXPONENT;
i++) {
double input = Math.scalb(2, i);
failures += testHypotCase(input, 0.0, input);
}
*** 123,133 ****
*/
java.util.Random rand = new java.util.Random();
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
-15 - Tests.ilogb(d));
for(int j = 0; j <= 13; j += 1) {
failures += testHypotCase(3*d, 4*d, 5*d, 2.5);
d *= 2.0; // increase exponent by 1
}
--- 121,131 ----
*/
java.util.Random rand = new java.util.Random();
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, 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);
d *= 2.0; // increase exponent by 1
}