test/java/lang/Math/PowTests.java

Print this page




   8  *
   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 4984407 5033578
  27  * @summary Tests for {Math, StrictMath}.pow



  28  * @author Joseph D. Darcy
  29  */
  30 
  31 public class PowTests {
  32     private PowTests(){}
  33 
  34     static final double infinityD = Double.POSITIVE_INFINITY;
  35 
  36     static int testPowCase(double input1, double input2, double expected) {
  37         int failures = 0;
  38         failures += Tests.test("StrictMath.pow(double, double)", input1, input2,
  39                                StrictMath.pow(input1, input2), expected);
  40         failures += Tests.test("Math.pow(double, double)", input1, input2,
  41                                Math.pow(input1, input2), expected);
  42         return failures;
  43     }
  44 
  45 
  46     static int testStrictPowCase(double input1, double input2, double expected) {
  47         int failures = 0;




   8  *
   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 4984407 5033578
  27  * @summary Tests for {Math, StrictMath}.pow
  28  * @library /lib/testlibrary
  29  * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
  30  * @run main PowTests
  31  * @author Joseph D. Darcy
  32  */
  33 
  34 public class PowTests {
  35     private PowTests(){}
  36 
  37     static final double infinityD = Double.POSITIVE_INFINITY;
  38 
  39     static int testPowCase(double input1, double input2, double expected) {
  40         int failures = 0;
  41         failures += Tests.test("StrictMath.pow(double, double)", input1, input2,
  42                                StrictMath.pow(input1, input2), expected);
  43         failures += Tests.test("Math.pow(double, double)", input1, input2,
  44                                Math.pow(input1, input2), expected);
  45         return failures;
  46     }
  47 
  48 
  49     static int testStrictPowCase(double input1, double input2, double expected) {
  50         int failures = 0;