PowTests.java revision 2362
486N/A * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 486N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 486N/A * This code is free software; you can redistribute it and/or modify it 486N/A * under the terms of the GNU General Public License version 2 only, as 486N/A * published by the Free Software Foundation. 486N/A * This code is distributed in the hope that it will be useful, but WITHOUT 486N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 486N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 486N/A * version 2 for more details (a copy is included in the LICENSE file that 486N/A * accompanied this code). 486N/A * You should have received a copy of the GNU General Public License version 486N/A * 2 along with this work; if not, write to the Free Software Foundation, 486N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 486N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 873N/A * or visit www.oracle.com if you need additional information or have any 486N/A * @summary Tests for {Math, StrictMath}.pow 486N/A * @author Joseph D. Darcy 3972N/A * Test for bad negation implementation. 3860N/A * Test cross-product of different kinds of arguments. 830N/A/**/ (
double) -((
1L<<
53)+
2L),
830N/A/**/ (
double) -((
1L<<
53)),
830N/A/**/ (
double) -((
1L<<
53)-
1L),
961N/A/**/ -
1.0000000000000004,
961N/A/* < -1.0 */ -
1.0000000000000002,
// nextAfter(-1.0, -oo) 2976N/A/* > -1.0 */ -
0.9999999999999999,
// nextAfter(-1.0, +oo) 486N/A/* > -1.0 */ -
0.9999999999999998,
4362N/A/* < +1.0 */ +
0.9999999999999999,
// nextAfter(-1.0, +oo) 2402N/A/* > 1.0 */ +
1.0000000000000002,
// nextAfter(+1.0, +oo) 2402N/A/**/ (
double) ((
1L<<
53)-
1L),
2402N/A/**/ (
double) ((
1L<<
53)+
2L),
}
/* end Double.isInfinite(y) */ }
else if (
Double.
isNaN(x)) {
// Now start switching on x static double f1(
double y) {
static double f2(
double y) {
static double f3(
double x,
double y) {
static double f3ns(
double x,
double y) {
* Return classification of argument: -1 for non-integers, 0 for * even integers, 1 for odd integers. if(!
isFinite(a) ||
// NaNs and infinities (a !=
Math.
floor(a) )) {
// only integers are fixed-points of floor // Determine if argument is an odd or even integer. if(a+
1.0 == a) {
// a > maximum odd floating-point integer return 0;
// Large integers are all even else {
// Convert double -> long and look at low-order bit return ((
ell &
0x1L) == (
long)
1)?
1:
0;