test/java/lang/Math/CubeRootTests.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 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.
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 26,36 ****
* @bug 4347132 4939441
* @summary Tests for {Math, StrictMath}.cbrt
* @author Joseph D. Darcy
*/
- import sun.misc.FpUtils;
import sun.misc.DoubleConsts;
public class CubeRootTests {
private CubeRootTests(){}
--- 26,35 ----
*** 243,254 ****
// Test near cbrt(2^(3n)) = 2^n.
for(int i = 18; i <= DoubleConsts.MAX_EXPONENT/3; i++) {
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
! pcNeighbors[1] = FpUtils.nextDown(pc);
! pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
for(int j = 0; j < pcNeighbors.length; j++) {
pcNeighborsCbrt[j] = Math.cbrt(pcNeighbors[j]);
--- 242,253 ----
// Test near cbrt(2^(3n)) = 2^n.
for(int i = 18; i <= DoubleConsts.MAX_EXPONENT/3; i++) {
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
! pcNeighbors[1] = Math.nextDown(pc);
! pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
for(int j = 0; j < pcNeighbors.length; j++) {
pcNeighborsCbrt[j] = Math.cbrt(pcNeighbors[j]);
*** 282,293 ****
// Test near cbrt(2^(-3n)) = 2^-n.
for(int i = -1; i >= DoubleConsts.MIN_SUB_EXPONENT/3; i--) {
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
! pcNeighbors[1] = FpUtils.nextDown(pc);
! pcNeighbors[0] = FpUtils.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
for(int j = 0; j < pcNeighbors.length; j++) {
pcNeighborsCbrt[j] = Math.cbrt(pcNeighbors[j]);
--- 281,292 ----
// Test near cbrt(2^(-3n)) = 2^-n.
for(int i = -1; i >= DoubleConsts.MIN_SUB_EXPONENT/3; i--) {
double pc = Math.scalb(1.0, 3*i);
pcNeighbors[2] = pc;
! pcNeighbors[1] = Math.nextDown(pc);
! pcNeighbors[0] = Math.nextDown(pcNeighbors[1]);
pcNeighbors[3] = Math.nextUp(pc);
pcNeighbors[4] = Math.nextUp(pcNeighbors[3]);
for(int j = 0; j < pcNeighbors.length; j++) {
pcNeighborsCbrt[j] = Math.cbrt(pcNeighbors[j]);