< prev index next >

test/java/lang/Math/CubeRootTests.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4347132 4939441
  27  * @summary Tests for {Math, StrictMath}.cbrt
  28  * @author Joseph D. Darcy

  29  */
  30 
  31 public class CubeRootTests {
  32     private CubeRootTests(){}
  33 
  34     static final double infinityD = Double.POSITIVE_INFINITY;
  35     static final double NaNd = Double.NaN;
  36 
  37     // Initialize shared random number generator
  38     static java.util.Random rand = new java.util.Random();
  39 
  40     static int testCubeRootCase(double input, double expected) {
  41         int failures=0;
  42 
  43         double minus_input = -input;
  44         double minus_expected = -expected;
  45 
  46         failures+=Tests.test("Math.cbrt(double)", input,
  47                              Math.cbrt(input), expected);
  48         failures+=Tests.test("Math.cbrt(double)", minus_input,




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4347132 4939441
  27  * @summary Tests for {Math, StrictMath}.cbrt
  28  * @author Joseph D. Darcy
  29  * @key randomness
  30  */
  31 
  32 public class CubeRootTests {
  33     private CubeRootTests(){}
  34 
  35     static final double infinityD = Double.POSITIVE_INFINITY;
  36     static final double NaNd = Double.NaN;
  37 
  38     // Initialize shared random number generator
  39     static java.util.Random rand = new java.util.Random();
  40 
  41     static int testCubeRootCase(double input, double expected) {
  42         int failures=0;
  43 
  44         double minus_input = -input;
  45         double minus_expected = -expected;
  46 
  47         failures+=Tests.test("Math.cbrt(double)", input,
  48                              Math.cbrt(input), expected);
  49         failures+=Tests.test("Math.cbrt(double)", minus_input,


< prev index next >