undefect. CWE-407 — 63 sites patched across 27 ecosystems

Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
This commit is contained in:
russell@unturf.com 2026-03-26 17:11:57 -04:00
commit 0a580b313d
70422 changed files with 17213626 additions and 0 deletions

View file

@ -0,0 +1,210 @@
/*
* Copyright (c) 2003, 2024, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4851638
* @key randomness
* @summary Tests for StrictMath.atan2
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build Atan2Tests
* @run main Atan2Tests
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/Atan2Tests.java test properties that should
* hold for any atan2 implementation, including the FDLIBM-based one
* required for StrictMath.atan2. Therefore, the test cases in
* ../Math/Atan2Tests.java are run against both the Math and
* StrictMath versions of atan2. The role of this test is to verify
* that the FDLIBM atan2 algorithm is being used by running golden
* file tests on values that may vary from one conforming atan2
* implementation to another.
*/
public class Atan2Tests {
private Atan2Tests(){}
public static void main(String... args) {
int failures = 0;
failures += testAtan2();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing atan2 incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
private static int testAtan2() {
int failures = 0;
// Empirical worst-case points in other libraries with larger
// worst-case errors than FDLIBM
double[][] testCases = {
{-0x0.00000000039a2p-1022, 0x0.000fdf02p-1022, -0x1.d0ce6fac85de9p-27},
{ 0x1.9173ea8221453p+842, 0x1.8c6f1b4b72f3ap+842, 0x1.9558272cbbdf9p-1},
{ 0x1.9cde4ff190e45p+931, 0x1.37d91467e558bp+931, 0x1.d909432d6f9c8p-1},
{ 0x1.401ec07d65549p+888, 0x1.3c3976605bb0cp+888, 0x1.95421cda9c65bp-1},
};
for (double[] testCase : testCases) {
failures += testAtan2Case(testCase[0], testCase[1], testCase[2]);
}
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.atan2 against transliteration port of atan2.
*/
private static int testAgainstTranslit() {
int failures = 0;
double MIN_VALUE = Double.MIN_VALUE;
double MIN_NORM = Double.MIN_NORMAL;
double MAX_VALUE = Double.MAX_VALUE;
double InfinityD = Double.POSITIVE_INFINITY;
double PI = Math.PI;
// The exact special cases for infinity, NaN, zero,
// etc. inputs are checked in the Math tests.
// Test exotic NaN bit patterns
double[][] exoticNaNs = {
{Double.longBitsToDouble(0x7FF0_0000_0000_0001L), 0.0},
{0.0, Double.longBitsToDouble(0x7FF0_0000_0000_0001L)},
{Double.longBitsToDouble(0xFFF_00000_0000_0001L), 0.0},
{0.0, Double.longBitsToDouble(0xFFF0_0000_0000_0001L)},
{Double.longBitsToDouble(0x7FF_00000_7FFF_FFFFL), 0.0},
{0.0, Double.longBitsToDouble(0x7FF0_7FFF_0000_FFFFL)},
{Double.longBitsToDouble(0xFFF_00000_7FFF_FFFFL), 0.0},
{0.0, Double.longBitsToDouble(0xFFF0_7FFF_0000_FFFFL)},
};
for (double[] exoticNaN: exoticNaNs) {
failures += testAtan2Case(exoticNaN[0], exoticNaN[1],
FdlibmTranslit.atan2(exoticNaN[0], exoticNaN[1]));
}
// Probe near decision points in the FDLIBM algorithm.
double[][] decisionPoints = {
// If x == 1, return atan(y)
{0.5, Math.nextDown(1.0)},
{0.5, 1.0},
{0.5, Math.nextUp(1.0)},
{ MIN_VALUE, MIN_VALUE},
{ MIN_VALUE, -MIN_VALUE},
{-MIN_VALUE, MIN_VALUE},
{-MIN_VALUE, -MIN_VALUE},
{ MAX_VALUE, MAX_VALUE},
{ MAX_VALUE, -MAX_VALUE},
{-MAX_VALUE, MAX_VALUE},
{-MAX_VALUE, -MAX_VALUE},
{ MIN_VALUE, MAX_VALUE},
{ MAX_VALUE, MIN_VALUE},
{-MIN_VALUE, MAX_VALUE},
{-MAX_VALUE, MIN_VALUE},
{MIN_VALUE, -MAX_VALUE},
{MAX_VALUE, -MIN_VALUE},
{-MIN_VALUE, -MAX_VALUE},
{-MAX_VALUE, -MIN_VALUE},
};
for (double[] decisionPoint: decisionPoints) {
failures += testAtan2Case(decisionPoint[0], decisionPoint[1],
FdlibmTranslit.atan2(decisionPoint[0], decisionPoint[1]));
}
// atan2 looks at the ratio y/x and executes different code
// paths accordingly: tests for 2^60 and 2^-60.
double y = 1.0;
double x = 0x1.0p60;
double increment_x = Math.ulp(x);
double increment_y = Math.ulp(y);
y = y - 128*increment_y;
x = x - 128*increment_x;
for (int i = 0; i < 256; i++, x += increment_x) {
for (int j = 0; j < 256; j++, y += increment_y) {
failures += testAtan2Case( y, x, FdlibmTranslit.atan2( y, x));
failures += testAtan2Case(-y, x, FdlibmTranslit.atan2(-y, x));
failures += testAtan2Case( y, -x, FdlibmTranslit.atan2( y, -x));
failures += testAtan2Case(-y, -x, FdlibmTranslit.atan2(-y, -x));
failures += testAtan2Case( 2.0*y, 2.0*x, FdlibmTranslit.atan2( 2.0*y, 2.0*x));
failures += testAtan2Case(-2.0*y, 2.0*x, FdlibmTranslit.atan2(-2.0*y, 2.0*x));
failures += testAtan2Case( 2.0*y, -2.0*x, FdlibmTranslit.atan2( 2.0*y, -2.0*x));
failures += testAtan2Case(-2.0*y, -2.0*x, FdlibmTranslit.atan2(-2.0*y, -2.0*x));
failures += testAtan2Case( 0.5*y, 0.5*x, FdlibmTranslit.atan2( 0.5*y, 0.5*x));
failures += testAtan2Case(-0.5*y, 0.5*x, FdlibmTranslit.atan2(-0.5*y, 0.5*x));
failures += testAtan2Case( 0.5*y, -0.5*x, FdlibmTranslit.atan2( 0.5*y, -0.5*x));
failures += testAtan2Case(-0.5*y, -0.5*x, FdlibmTranslit.atan2(-0.5*y, -0.5*x));
// Switch argument position
failures += testAtan2Case( x, y, FdlibmTranslit.atan2( x, y));
failures += testAtan2Case(-x, y, FdlibmTranslit.atan2(-x, y));
failures += testAtan2Case( x, -y, FdlibmTranslit.atan2( x, -y));
failures += testAtan2Case(-x, -y, FdlibmTranslit.atan2(-x, -y));
failures += testAtan2Case( 0.5*x, 0.5*y, FdlibmTranslit.atan2( 0.5*x, 0.5*y));
failures += testAtan2Case(-0.5*x, 0.5*y, FdlibmTranslit.atan2(-0.5*x, 0.5*y));
failures += testAtan2Case( 0.5*x, -0.5*y, FdlibmTranslit.atan2( 0.5*x, -0.5*y));
failures += testAtan2Case(-0.5*x, -0.5*y, FdlibmTranslit.atan2(-0.5*x, -0.5*y));
}
}
// Check random values
for (int k = 0; k < 200; k++ ) {
y = random.nextDouble();
x = random.nextDouble();
failures += testAtan2Case(y, x, FdlibmTranslit.atan2(y, x));
}
return failures;
}
private static int testAtan2Case(double input1, double input2, double expected) {
int failures = 0;
failures += Tests.test("StrictMath.atan2(double)", input1, input2,
StrictMath::atan2, expected);
return failures;
}
}

View file

@ -0,0 +1,532 @@
/*
* Copyright (c) 2003, 2025, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4347132 8136799
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build CubeRootTests
* @run main CubeRootTests
* @summary Tests specifically for StrictMath.cbrt
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/CubeRootTests.java test properties that should
* hold for any cube root implementation, including the FDLIBM-based
* one required for StrictMath.cbrt. Therefore, the test cases in
* ../Math/CubeRootTests.java are run against both the Math and
* StrictMath versions of cube root. The role of this test is to
* verify that the FDLIBM cbrt algorithm is being used by running
* golden file tests on values that may vary from one conforming cube
* root implementation to another.
*/
public class CubeRootTests {
private CubeRootTests(){}
public static void main(String... args) {
int failures = 0;
failures += testCubeRoot();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing the cube root incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
static int testCubeRootCase(double input, double expected) {
int failures=0;
double minus_input = -input;
double minus_expected = -expected;
failures+=Tests.test("StrictMath.cbrt(double)", input,
StrictMath::cbrt, expected);
failures+=Tests.test("StrictMath.cbrt(double)", minus_input,
StrictMath::cbrt, minus_expected);
return failures;
}
static int testCubeRoot() {
int failures = 0;
double [][] testCases = {
{0x1.ffffffffffffep-766, 0x1.fffffffffffffp-256},
{0x1.ffffffffffffep-763, 0x1.fffffffffffffp-255},
{0x1.ffffffffffffep-760, 0x1.fffffffffffffp-254},
{0x1.ffffffffffffep-757, 0x1.fffffffffffffp-253},
{0x1.ffffffffffffep-754, 0x1.fffffffffffffp-252},
{0x1.ffffffffffffep-751, 0x1.fffffffffffffp-251},
{0x1.ffffffffffffep-748, 0x1.fffffffffffffp-250},
{0x1.ffffffffffffep-745, 0x1.fffffffffffffp-249},
{0x1.ffffffffffffep-742, 0x1.fffffffffffffp-248},
{0x1.ffffffffffffep-739, 0x1.fffffffffffffp-247},
{0x1.ffffffffffffep-1006, 0x1.fffffffffffffp-336},
{0x1.ffffffffffffep-736, 0x1.fffffffffffffp-246},
{0x1.ffffffffffffep-733, 0x1.fffffffffffffp-245},
{0x1.ffffffffffffep-730, 0x1.fffffffffffffp-244},
{0x1.ffffffffffffep-727, 0x1.fffffffffffffp-243},
{0x1.ffffffffffffep-724, 0x1.fffffffffffffp-242},
{0x1.ffffffffffffep-721, 0x1.fffffffffffffp-241},
{0x1.ffffffffffffep-718, 0x1.fffffffffffffp-240},
{0x1.ffffffffffffep-715, 0x1.fffffffffffffp-239},
{0x1.ffffffffffffep-712, 0x1.fffffffffffffp-238},
{0x1.ffffffffffffep-709, 0x1.fffffffffffffp-237},
{0x1.ffffffffffffep-706, 0x1.fffffffffffffp-236},
{0x1.ffffffffffffep-703, 0x1.fffffffffffffp-235},
{0x1.ffffffffffffep-700, 0x1.fffffffffffffp-234},
{0x1.ffffffffffffep-697, 0x1.fffffffffffffp-233},
{0x1.ffffffffffffep-694, 0x1.fffffffffffffp-232},
{0x1.ffffffffffffep-691, 0x1.fffffffffffffp-231},
{0x1.ffffffffffffep-1003, 0x1.fffffffffffffp-335},
{0x1.ffffffffffffep-688, 0x1.fffffffffffffp-230},
{0x1.ffffffffffffep-685, 0x1.fffffffffffffp-229},
{0x1.ffffffffffffep-682, 0x1.fffffffffffffp-228},
{0x1.ffffffffffffep-679, 0x1.fffffffffffffp-227},
{0x1.ffffffffffffep-676, 0x1.fffffffffffffp-226},
{0x1.ffffffffffffep-673, 0x1.fffffffffffffp-225},
{0x1.ffffffffffffep-670, 0x1.fffffffffffffp-224},
{0x1.ffffffffffffep-667, 0x1.fffffffffffffp-223},
{0x1.ffffffffffffep-664, 0x1.fffffffffffffp-222},
{0x1.ffffffffffffep-661, 0x1.fffffffffffffp-221},
{0x1.ffffffffffffep-658, 0x1.fffffffffffffp-220},
{0x1.ffffffffffffep-655, 0x1.fffffffffffffp-219},
{0x1.ffffffffffffep-652, 0x1.fffffffffffffp-218},
{0x1.ffffffffffffep-649, 0x1.fffffffffffffp-217},
{0x1.ffffffffffffep-646, 0x1.fffffffffffffp-216},
{0x1.ffffffffffffep-643, 0x1.fffffffffffffp-215},
{0x1.ffffffffffffep-1000, 0x1.fffffffffffffp-334},
{0x1.ffffffffffffep-640, 0x1.fffffffffffffp-214},
{0x1.ffffffffffffep-637, 0x1.fffffffffffffp-213},
{0x1.ffffffffffffep-634, 0x1.fffffffffffffp-212},
{0x1.ffffffffffffep-631, 0x1.fffffffffffffp-211},
{0x1.ffffffffffffep-628, 0x1.fffffffffffffp-210},
{0x1.ffffffffffffep-625, 0x1.fffffffffffffp-209},
{0x1.ffffffffffffep-622, 0x1.fffffffffffffp-208},
{0x1.ffffffffffffep-619, 0x1.fffffffffffffp-207},
{0x1.ffffffffffffep-616, 0x1.fffffffffffffp-206},
{0x1.ffffffffffffep-613, 0x1.fffffffffffffp-205},
{0x1.ffffffffffffep-610, 0x1.fffffffffffffp-204},
{0x1.ffffffffffffep-607, 0x1.fffffffffffffp-203},
{0x1.ffffffffffffep-604, 0x1.fffffffffffffp-202},
{0x1.ffffffffffffep-601, 0x1.fffffffffffffp-201},
{0x1.ffffffffffffep-598, 0x1.fffffffffffffp-200},
{0x1.ffffffffffffep-595, 0x1.fffffffffffffp-199},
{0x1.ffffffffffffep-997, 0x1.fffffffffffffp-333},
{0x1.ffffffffffffep-592, 0x1.fffffffffffffp-198},
{0x1.ffffffffffffep-589, 0x1.fffffffffffffp-197},
{0x1.ffffffffffffep-586, 0x1.fffffffffffffp-196},
{0x1.ffffffffffffep-583, 0x1.fffffffffffffp-195},
{0x1.ffffffffffffep-580, 0x1.fffffffffffffp-194},
{0x1.ffffffffffffep-577, 0x1.fffffffffffffp-193},
{0x1.ffffffffffffep-574, 0x1.fffffffffffffp-192},
{0x1.ffffffffffffep-571, 0x1.fffffffffffffp-191},
{0x1.ffffffffffffep-568, 0x1.fffffffffffffp-190},
{0x1.ffffffffffffep-565, 0x1.fffffffffffffp-189},
{0x1.ffffffffffffep-562, 0x1.fffffffffffffp-188},
{0x1.ffffffffffffep-559, 0x1.fffffffffffffp-187},
{0x1.ffffffffffffep-556, 0x1.fffffffffffffp-186},
{0x1.ffffffffffffep-553, 0x1.fffffffffffffp-185},
{0x1.ffffffffffffep-550, 0x1.fffffffffffffp-184},
{0x1.ffffffffffffep-547, 0x1.fffffffffffffp-183},
{0x1.ffffffffffffep-994, 0x1.fffffffffffffp-332},
{0x1.ffffffffffffep-544, 0x1.fffffffffffffp-182},
{0x1.ffffffffffffep-541, 0x1.fffffffffffffp-181},
{0x1.ffffffffffffep-538, 0x1.fffffffffffffp-180},
{0x1.ffffffffffffep-535, 0x1.fffffffffffffp-179},
{0x1.ffffffffffffep-532, 0x1.fffffffffffffp-178},
{0x1.ffffffffffffep-529, 0x1.fffffffffffffp-177},
{0x0.00000000001fp-1022, 0x1.fa9c313858568p-356},
{0x1.ffffffffffffep-526, 0x1.fffffffffffffp-176},
{0x1.ffffffffffffep-523, 0x1.fffffffffffffp-175},
{0x1.ffffffffffffep-520, 0x1.fffffffffffffp-174},
{0x1.ffffffffffffep-517, 0x1.fffffffffffffp-173},
{0x0.00000000001fdp-1022, 0x1.feff7f94ea34dp-356},
{0x1.ffffffffffffep-514, 0x1.fffffffffffffp-172},
{0x0.00000001fffe7p-1022, 0x1.ffff7aaa87f1bp-352},
{0x0.00000001fffffp-1022, 0x1.fffffaaaaa9c7p-352},
{0x0.00001ffffff4p-1022, 0x1.ffffffcp-348},
{0x0.00001ffffffffp-1022, 0x1.ffffffffaaaabp-348},
{0x0.01ffffffffffcp-1022, 0x1.ffffffffffeabp-344},
{0x1.ffffffffffffep-511, 0x1.fffffffffffffp-171},
{0x1.ffffffffffffep-508, 0x1.fffffffffffffp-170},
{0x1.ffffffffffffep-505, 0x1.fffffffffffffp-169},
{0x1.ffffffffffffep-502, 0x1.fffffffffffffp-168},
{0x1.ffffffffffffep-499, 0x1.fffffffffffffp-167},
{0x1.ffffffffffffep-991, 0x1.fffffffffffffp-331},
{0x1.ffffffffffffep-496, 0x1.fffffffffffffp-166},
{0x1.ffffffffffffep-493, 0x1.fffffffffffffp-165},
{0x1.ffffffffffffep-490, 0x1.fffffffffffffp-164},
{0x1.ffffffffffffep-487, 0x1.fffffffffffffp-163},
{0x1.ffffffffffffep-484, 0x1.fffffffffffffp-162},
{0x1.ffffffffffffep-481, 0x1.fffffffffffffp-161},
{0x1.ffffffffffffep-478, 0x1.fffffffffffffp-160},
{0x1.ffffffffffffep-475, 0x1.fffffffffffffp-159},
{0x1.ffffffffffffep-472, 0x1.fffffffffffffp-158},
{0x1.ffffffffffffep-469, 0x1.fffffffffffffp-157},
{0x1.ffffffffffffep-466, 0x1.fffffffffffffp-156},
{0x1.ffffffffffffep-463, 0x1.fffffffffffffp-155},
{0x1.ffffffffffffep-460, 0x1.fffffffffffffp-154},
{0x1.ffffffffffffep-457, 0x1.fffffffffffffp-153},
{0x1.ffffffffffffep-454, 0x1.fffffffffffffp-152},
{0x1.ffffffffffffep-451, 0x1.fffffffffffffp-151},
{0x1.ffffffffffffep-988, 0x1.fffffffffffffp-330},
{0x1.ffffffffffffep-448, 0x1.fffffffffffffp-150},
{0x1.ffffffffffffep-445, 0x1.fffffffffffffp-149},
{0x1.ffffffffffffep-442, 0x1.fffffffffffffp-148},
{0x1.ffffffffffffep-439, 0x1.fffffffffffffp-147},
{0x1.ffffffffffffep-436, 0x1.fffffffffffffp-146},
{0x1.ffffffffffffep-433, 0x1.fffffffffffffp-145},
{0x1.ffffffffffffep-430, 0x1.fffffffffffffp-144},
{0x1.ffffffffffffep-427, 0x1.fffffffffffffp-143},
{0x1.ffffffffffffep-424, 0x1.fffffffffffffp-142},
{0x1.ffffffffffffep-421, 0x1.fffffffffffffp-141},
{0x1.ffffffffffffep-418, 0x1.fffffffffffffp-140},
{0x1.ffffffffffffep-415, 0x1.fffffffffffffp-139},
{0x1.ffffffffffffep-412, 0x1.fffffffffffffp-138},
{0x1.ffffffffffffep-409, 0x1.fffffffffffffp-137},
{0x1.ffffffffffffep-406, 0x1.fffffffffffffp-136},
{0x1.ffffffffffffep-403, 0x1.fffffffffffffp-135},
{0x1.ffffffffffffep-985, 0x1.fffffffffffffp-329},
{0x1.ffffffffffffep-400, 0x1.fffffffffffffp-134},
{0x1.ffffffffffffep-397, 0x1.fffffffffffffp-133},
{0x1.ffffffffffffep-394, 0x1.fffffffffffffp-132},
{0x1.ffffffffffffep-391, 0x1.fffffffffffffp-131},
{0x1.ffffffffffffep-388, 0x1.fffffffffffffp-130},
{0x1.ffffffffffffep-385, 0x1.fffffffffffffp-129},
{0x1.ffffffffffffep-382, 0x1.fffffffffffffp-128},
{0x1.ffffffffffffep-379, 0x1.fffffffffffffp-127},
{0x1.ffffffffffffep-376, 0x1.fffffffffffffp-126},
{0x1.ffffffffffffep-373, 0x1.fffffffffffffp-125},
{0x1.ffffffffffffep-370, 0x1.fffffffffffffp-124},
{0x1.ffffffffffffep-367, 0x1.fffffffffffffp-123},
{0x1.ffffffffffffep-364, 0x1.fffffffffffffp-122},
{0x1.ffffffffffffep-361, 0x1.fffffffffffffp-121},
{0x1.ffffffffffffep-358, 0x1.fffffffffffffp-120},
{0x1.ffffffffffffep-355, 0x1.fffffffffffffp-119},
{0x1.ffffffffffffep-982, 0x1.fffffffffffffp-328},
{0x1.ffffffffffffep-352, 0x1.fffffffffffffp-118},
{0x1.ffffffffffffep-349, 0x1.fffffffffffffp-117},
{0x1.ffffffffffffep-346, 0x1.fffffffffffffp-116},
{0x1.ffffffffffffep-343, 0x1.fffffffffffffp-115},
{0x1.ffffffffffffep-340, 0x1.fffffffffffffp-114},
{0x1.ffffffffffffep-337, 0x1.fffffffffffffp-113},
{0x1.ffffffffffffep-334, 0x1.fffffffffffffp-112},
{0x1.ffffffffffffep-331, 0x1.fffffffffffffp-111},
{0x1.ffffffffffffep-328, 0x1.fffffffffffffp-110},
{0x1.ffffffffffffep-325, 0x1.fffffffffffffp-109},
{0x1.ffffffffffffep-322, 0x1.fffffffffffffp-108},
{0x1.ffffffffffffep-319, 0x1.fffffffffffffp-107},
{0x1.ffffffffffffep-316, 0x1.fffffffffffffp-106},
{0x1.ffffffffffffep-313, 0x1.fffffffffffffp-105},
{0x1.ffffffffffffep-310, 0x1.fffffffffffffp-104},
{0x1.ffffffffffffep-307, 0x1.fffffffffffffp-103},
{0x1.ffffffffffffep-979, 0x1.fffffffffffffp-327},
{0x1.ffffffffffffep-304, 0x1.fffffffffffffp-102},
{0x1.ffffffffffffep-301, 0x1.fffffffffffffp-101},
{0x1.ffffffffffffep-298, 0x1.fffffffffffffp-100},
{0x1.ffffffffffffep-295, 0x1.fffffffffffffp-99},
{0x1.ffffffffffffep-292, 0x1.fffffffffffffp-98},
{0x1.ffffffffffffep-289, 0x1.fffffffffffffp-97},
{0x1.ffffffffffffep-286, 0x1.fffffffffffffp-96},
{0x1.ffffffffffffep-283, 0x1.fffffffffffffp-95},
{0x1.ffffffffffffep-280, 0x1.fffffffffffffp-94},
{0x1.ffffffffffffep-277, 0x1.fffffffffffffp-93},
{0x1.ffffffffffffep-274, 0x1.fffffffffffffp-92},
{0x1.ffffffffffffep-271, 0x1.fffffffffffffp-91},
{0x1.ffffffffffffep-268, 0x1.fffffffffffffp-90},
{0x1.ffffffffffffep-265, 0x1.fffffffffffffp-89},
{0x1.ffffffffffffep-262, 0x1.fffffffffffffp-88},
{0x1.ffffffffffffep-259, 0x1.fffffffffffffp-87},
{0x1.ffffffffffffep-1021, 0x1.fffffffffffffp-341},
{0x1.ffffffffffffep-976, 0x1.fffffffffffffp-326},
{0x1.ffffffffffffep-256, 0x1.fffffffffffffp-86},
{0x1.ffffffffffffep-253, 0x1.fffffffffffffp-85},
{0x1.ffffffffffffep-250, 0x1.fffffffffffffp-84},
{0x1.ffffffffffffep-247, 0x1.fffffffffffffp-83},
{0x1.ffffffffffffep-244, 0x1.fffffffffffffp-82},
{0x1.ffffffffffffep-241, 0x1.fffffffffffffp-81},
{0x1.ffffffffffffep-238, 0x1.fffffffffffffp-80},
{0x1.ffffffffffffep-235, 0x1.fffffffffffffp-79},
{0x1.ffffffffffffep-232, 0x1.fffffffffffffp-78},
{0x1.ffffffffffffep-229, 0x1.fffffffffffffp-77},
{0x1.ffffffffffffep-226, 0x1.fffffffffffffp-76},
{0x1.ffffffffffffep-223, 0x1.fffffffffffffp-75},
{0x1.ffffffffffffep-220, 0x1.fffffffffffffp-74},
{0x1.ffffffffffffep-217, 0x1.fffffffffffffp-73},
{0x1.ffffffffffffep-214, 0x1.fffffffffffffp-72},
{0x1.ffffffffffffep-211, 0x1.fffffffffffffp-71},
{0x1.ffffffffffffep-973, 0x1.fffffffffffffp-325},
{0x1.ffffffffffffep-208, 0x1.fffffffffffffp-70},
{0x1.ffffffffffffep-205, 0x1.fffffffffffffp-69},
{0x1.ffffffffffffep-202, 0x1.fffffffffffffp-68},
{0x1.ffffffffffffep-199, 0x1.fffffffffffffp-67},
{0x1.ffffffffffffep-196, 0x1.fffffffffffffp-66},
{0x1.ffffffffffffep-193, 0x1.fffffffffffffp-65},
{0x1.ffffffffffffep-190, 0x1.fffffffffffffp-64},
{0x1.ffffffffffffep-187, 0x1.fffffffffffffp-63},
{0x1.ffffffffffffep-184, 0x1.fffffffffffffp-62},
{0x1.ffffffffffffep-181, 0x1.fffffffffffffp-61},
{0x1.ffffffffffffep-178, 0x1.fffffffffffffp-60},
{0x1.ffffffffffffep-175, 0x1.fffffffffffffp-59},
{0x1.ffffffffffffep-172, 0x1.fffffffffffffp-58},
{0x1.ffffffffffffep-169, 0x1.fffffffffffffp-57},
{0x1.ffffffffffffep-166, 0x1.fffffffffffffp-56},
{0x1.ffffffffffffep-163, 0x1.fffffffffffffp-55},
{0x1.ffffffffffffep-970, 0x1.fffffffffffffp-324},
{0x1.ffffffffffffep-160, 0x1.fffffffffffffp-54},
{0x1.ffffffffffffep-157, 0x1.fffffffffffffp-53},
{0x1.ffffffffffffep-154, 0x1.fffffffffffffp-52},
{0x1.ffffffffffffep-151, 0x1.fffffffffffffp-51},
{0x1.ffffffffffffep-148, 0x1.fffffffffffffp-50},
{0x1.ffffffffffffep-145, 0x1.fffffffffffffp-49},
{0x1.ffffffffffffep-142, 0x1.fffffffffffffp-48},
{0x1.ffffffffffffep-139, 0x1.fffffffffffffp-47},
{0x1.ffffffffffffep-136, 0x1.fffffffffffffp-46},
{0x1.ffffffffffffep-133, 0x1.fffffffffffffp-45},
{0x1.ffffffffffffep-130, 0x1.fffffffffffffp-44},
{0x1.ffffffffffffep-127, 0x1.fffffffffffffp-43},
{0x1.ffffffffffffep-124, 0x1.fffffffffffffp-42},
{0x1.ffffffffffffep-121, 0x1.fffffffffffffp-41},
{0x1.ffffffffffffep-118, 0x1.fffffffffffffp-40},
{0x1.ffffffffffffep-115, 0x1.fffffffffffffp-39},
{0x1.ffffffffffffep-967, 0x1.fffffffffffffp-323},
{0x1.ffffffffffffep-112, 0x1.fffffffffffffp-38},
{0x1.ffffffffffffep-109, 0x1.fffffffffffffp-37},
{0x1.ffffffffffffep-106, 0x1.fffffffffffffp-36},
{0x1.ffffffffffffep-103, 0x1.fffffffffffffp-35},
{0x1.ffffffffffffep-100, 0x1.fffffffffffffp-34},
{0x1.ffffffffffffep-97, 0x1.fffffffffffffp-33},
{0x1.ffffffffffffep-94, 0x1.fffffffffffffp-32},
{0x1.ffffffffffffep-91, 0x1.fffffffffffffp-31},
{0x1.ffffffffffffep-88, 0x1.fffffffffffffp-30},
{0x1.ffffffffffffep-85, 0x1.fffffffffffffp-29},
{0x1.ffffffffffffep-82, 0x1.fffffffffffffp-28},
{0x1.ffffffffffffep-79, 0x1.fffffffffffffp-27},
{0x1.ffffffffffffep-76, 0x1.fffffffffffffp-26},
{0x1.ffffffffffffep-73, 0x1.fffffffffffffp-25},
{0x1.ffffffffffffep-70, 0x1.fffffffffffffp-24},
{0x1.ffffffffffffep-67, 0x1.fffffffffffffp-23},
{0x1.ffffffffffffep-964, 0x1.fffffffffffffp-322},
{0x1.ffffffffffffep-64, 0x1.fffffffffffffp-22},
{0x1.ffffffffffffep-61, 0x1.fffffffffffffp-21},
{0x1.ffffffffffffep-58, 0x1.fffffffffffffp-20},
{0x1.ffffffffffffep-55, 0x1.fffffffffffffp-19},
{0x1.ffffffffffffep-52, 0x1.fffffffffffffp-18},
{0x1.ffffffffffffep-49, 0x1.fffffffffffffp-17},
{0x1.ffffffffffffep-46, 0x1.fffffffffffffp-16},
{0x1.ffffffffffffep-43, 0x1.fffffffffffffp-15},
{0x1.ffffffffffffep-40, 0x1.fffffffffffffp-14},
{0x1.ffffffffffffep-37, 0x1.fffffffffffffp-13},
{0x1.ffffffffffffep-34, 0x1.fffffffffffffp-12},
{0x1.ffffffffffffep-31, 0x1.fffffffffffffp-11},
{0x1.ffffffffffffep-28, 0x1.fffffffffffffp-10},
{0x1.ffffffffffffep-25, 0x1.fffffffffffffp-9},
{0x1.ffffffffffffep-22, 0x1.fffffffffffffp-8},
{0x0.000000000003ep-1022, 0x1.fa9c313858568p-357},
{0x1.ffffffffffffep-19, 0x1.fffffffffffffp-7},
{0x1.ffffffffffffep-961, 0x1.fffffffffffffp-321},
{0x1.ffffffffffffep-16, 0x1.fffffffffffffp-6},
{0x1.ffffffffffffep-13, 0x1.fffffffffffffp-5},
{0x1.ffffffffffffep-10, 0x1.fffffffffffffp-4},
{0x1.ffffffffffffep-7, 0x1.fffffffffffffp-3},
{0x0.000000000003fp-1022, 0x1.fd51bf2069fe6p-357},
{0x1.ffffffffffffep-4, 0x1.fffffffffffffp-2},
{0x1.ffffffffffffep-1, 0x1.fffffffffffffp-1},
{0x0.000000003fffcp-1022, 0x1.ffff55551c71bp-353},
{0x0.000003fffffe8p-1022, 0x1.ffffffcp-349},
{0x0.000003ffffffcp-1022, 0x1.fffffff555555p-349},
{0x0.003fffffffff9p-1022, 0x1.fffffffffed55p-345},
{0x1.ffffffffffffep2, 0x1.fffffffffffffp0},
{0x1.bp4, 0x1.8p1},
{0x1.ffffffffffffep5, 0x1.fffffffffffffp1},
{0x1.f3ffffffffff4p6, 0x1.3fffffffffffep2},
{0x1.f3ffffffffffcp6, 0x1.3ffffffffffffp2},
{0x1.bp7, 0x1.8p2},
{0x1.56ffffffffffep8, 0x1.bffffffffffffp2},
{0x1.ffffffffffffep8, 0x1.fffffffffffffp2},
{0x1.6c8p9, 0x1.2p3},
{0x1.f3ffffffffff4p9, 0x1.3fffffffffffep3},
{0x1.f3ffffffffffcp9, 0x1.3ffffffffffffp3},
{0x1.4cbfffffffffcp10, 0x1.5fffffffffffep3},
{0x1.4cbfffffffffep10, 0x1.5ffffffffffffp3},
{0x1.bp10, 0x1.8p3},
{0x1.129ffffffffa4p11, 0x1.9ffffffffffd1p3},
{0x1.129fffffffffep11, 0x1.9ffffffffffffp3},
{0x1.56ffffffffffep11, 0x1.bffffffffffffp3},
{0x1.a5ep11, 0x1.ep3},
{0x1.ffffffffffffep11, 0x1.fffffffffffffp3},
{0x1.330fffffffc1ep12, 0x1.0fffffffffedbp4},
{0x1.331p12, 0x1.1p4},
{0x1.6c8p12, 0x1.2p4},
{0x1.acafffffffffap12, 0x1.2ffffffffffffp4},
{0x1.acafffffffffep12, 0x1.2ffffffffffffp4},
{0x1.ffffffffffffep-958, 0x1.fffffffffffffp-320},
{0x1.ffffffffffffep-955, 0x1.fffffffffffffp-319},
{0x1.ffffffffffffep-952, 0x1.fffffffffffffp-318},
{0x1.ffffffffffffep-949, 0x1.fffffffffffffp-317},
{0x1.ffffffffffffep-946, 0x1.fffffffffffffp-316},
{0x1.ffffffffffffep-943, 0x1.fffffffffffffp-315},
{0x1.ffffffffffffep-940, 0x1.fffffffffffffp-314},
{0x1.ffffffffffffep-937, 0x1.fffffffffffffp-313},
{0x1.ffffffffffffep-934, 0x1.fffffffffffffp-312},
{0x1.ffffffffffffep-931, 0x1.fffffffffffffp-311},
{0x1.ffffffffffffep-1018, 0x1.fffffffffffffp-340},
{0x1.ffffffffffffep-928, 0x1.fffffffffffffp-310},
{0x1.ffffffffffffep-925, 0x1.fffffffffffffp-309},
{0x1.ffffffffffffep-922, 0x1.fffffffffffffp-308},
{0x1.ffffffffffffep-919, 0x1.fffffffffffffp-307},
{0x1.ffffffffffffep-916, 0x1.fffffffffffffp-306},
{0x1.ffffffffffffep-913, 0x1.fffffffffffffp-305},
{0x1.ffffffffffffep-910, 0x1.fffffffffffffp-304},
{0x1.ffffffffffffep-907, 0x1.fffffffffffffp-303},
{0x1.ffffffffffffep-904, 0x1.fffffffffffffp-302},
{0x0.0000000000007p-1022, 0x1.e9b5dba58189ep-358},
{0x1.ffffffffffffep-901, 0x1.fffffffffffffp-301},
{0x1.ffffffffffffep-898, 0x1.fffffffffffffp-300},
{0x0.0000000007ffp-1022, 0x1.ffeaa9c70ca31p-354},
{0x0.0000000007ffep-1022, 0x1.fffd5551c7149p-354},
{0x0.0000007fffffdp-1022, 0x1.ffffffcp-350},
{0x0.0000007fffffep-1022, 0x1.ffffffd555555p-350},
{0x0.0007ffffffffap-1022, 0x1.fffffffff8p-346},
{0x0.7ffffffffffffp-1022, 0x1.fffffffffffffp-342},
{0x1.ffffffffffffep-895, 0x1.fffffffffffffp-299},
{0x1.ffffffffffffep-892, 0x1.fffffffffffffp-298},
{0x1.ffffffffffffep-889, 0x1.fffffffffffffp-297},
{0x1.ffffffffffffep-886, 0x1.fffffffffffffp-296},
{0x1.ffffffffffffep-883, 0x1.fffffffffffffp-295},
{0x1.ffffffffffffep-1015, 0x1.fffffffffffffp-339},
{0x1.ffffffffffffep-880, 0x1.fffffffffffffp-294},
{0x1.ffffffffffffep-877, 0x1.fffffffffffffp-293},
{0x1.ffffffffffffep-874, 0x1.fffffffffffffp-292},
{0x1.ffffffffffffep-871, 0x1.fffffffffffffp-291},
{0x1.ffffffffffffep-868, 0x1.fffffffffffffp-290},
{0x1.ffffffffffffep-865, 0x1.fffffffffffffp-289},
{0x1.ffffffffffffep-862, 0x1.fffffffffffffp-288},
{0x1.ffffffffffffep-859, 0x1.fffffffffffffp-287},
{0x1.ffffffffffffep-856, 0x1.fffffffffffffp-286},
{0x1.ffffffffffffep-853, 0x1.fffffffffffffp-285},
{0x1.ffffffffffffep-850, 0x1.fffffffffffffp-284},
{0x1.ffffffffffffep-847, 0x1.fffffffffffffp-283},
{0x1.ffffffffffffep-844, 0x1.fffffffffffffp-282},
{0x1.ffffffffffffep-841, 0x1.fffffffffffffp-281},
{0x1.ffffffffffffep-838, 0x1.fffffffffffffp-280},
{0x1.ffffffffffffep-835, 0x1.fffffffffffffp-279},
{0x1.ffffffffffffep-1012, 0x1.fffffffffffffp-338},
{0x1.ffffffffffffep-832, 0x1.fffffffffffffp-278},
{0x1.ffffffffffffep-829, 0x1.fffffffffffffp-277},
{0x1.ffffffffffffep-826, 0x1.fffffffffffffp-276},
{0x1.ffffffffffffep-823, 0x1.fffffffffffffp-275},
{0x1.ffffffffffffep-820, 0x1.fffffffffffffp-274},
{0x1.ffffffffffffep-817, 0x1.fffffffffffffp-273},
{0x1.ffffffffffffep-814, 0x1.fffffffffffffp-272},
{0x1.ffffffffffffep-811, 0x1.fffffffffffffp-271},
{0x1.ffffffffffffep-808, 0x1.fffffffffffffp-270},
{0x1.ffffffffffffep-805, 0x1.fffffffffffffp-269},
{0x1.ffffffffffffep-802, 0x1.fffffffffffffp-268},
{0x1.ffffffffffffep-799, 0x1.fffffffffffffp-267},
{0x1.ffffffffffffep-796, 0x1.fffffffffffffp-266},
{0x1.ffffffffffffep-793, 0x1.fffffffffffffp-265},
{0x1.ffffffffffffep-790, 0x1.fffffffffffffp-264},
{0x1.ffffffffffffep-787, 0x1.fffffffffffffp-263},
{0x1.ffffffffffffep-1009, 0x1.fffffffffffffp-337},
{0x1.ffffffffffffep-784, 0x1.fffffffffffffp-262},
{0x1.ffffffffffffep-781, 0x1.fffffffffffffp-261},
{0x1.ffffffffffffep-778, 0x1.fffffffffffffp-260},
{0x1.ffffffffffffep-775, 0x1.fffffffffffffp-259},
{0x1.ffffffffffffep-772, 0x1.fffffffffffffp-258},
{0x1.ffffffffffffep-769, 0x1.fffffffffffffp-257},
{0x0.0000000000ffep-1022, 0x1.ffeaa9c70ca31p-355},
{0x0.0000000000fffp-1022, 0x1.fff5551c6fcd6p-355},
{0x0.0000000ffff86p-1022, 0x1.ffffaeaa9dbf1p-351},
{0x0.0000000ffffffp-1022, 0x1.ffffff5555552p-351},
{0x0.0000ffffffap-1022, 0x1.ffffffcp-347},
{0x0.0000ffffffff8p-1022, 0x1.ffffffffaaaabp-347},
{0x0.0fffffffffffbp-1022, 0x1.fffffffffffcbp-343},
{-0x1.0edb6c7fa500fp-531, -0x1.04dc0b189b6cep-177}, // next down from Julia value
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{ 0x1.7a337e1ba1ec2p-257, 0x1.6f59116ea884dp-86},
{ 0x0.7ffffffffffffp-1022, 0x1.fffffffffffffp-342},
{-0x1.00ddafe7d9deep-885, -0x1.0049d002f249fp-295},
{ 0x1.fed1fe9f1122dp+11, 0x1.ff9b410e1f8b4p3},
{-0x1.55cd285f321f6p-64, -0x1.bf7a40bced214p-22},
{ 0x1.fffb101d89c1dp-332, 0x1.965e9bf0fb7fbp-111},
};
for(double[] testCase: testCases)
failures+=testCubeRootCase(testCase[0], testCase[1]);
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.cbrt against transliteration port of cbrt.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x;
// Test just above subnormal threshold...
x = Double.MIN_NORMAL;
failures += testRange(x, Math.ulp(x), 1000);
// ... and just below subnormal threshold ...
x = Math.nextDown(Double.MIN_NORMAL);
failures += testRange(x, -Math.ulp(x), 1000);
// ... and near zero.
failures += testRange(0.0, Double.MIN_VALUE, 1000);
x = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold. Don't worry about test
// elements overflowing to infinity if the starting value is
// near Double.MAX_VALUE.
failures += testRange(x, 2.0 * Math.ulp(x), 1000);
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testCubeRootCase(x, FdlibmTranslit.Cbrt.compute(x));
}
return failures;
}
}

View file

@ -0,0 +1,342 @@
/*
* Copyright (c) 2012, 2019, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.math.BigInteger;
/**
* @test Test for StrictMath.*Exact integer and long methods.
* @bug 6708398
* @summary Basic tests for StrictMath exact arithmetic operations.
*
* @author Roger Riggs
*/
public class ExactArithTests {
/**
* The count of test errors.
*/
private static int errors = 0;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
testIntegerExact();
testLongExact();
if (errors > 0) {
throw new RuntimeException(errors + " errors found in ExactArithTests.");
}
}
static void fail(String message) {
errors++;
System.err.println(message);
}
/**
* Test StrictMath.addExact, multiplyExact, subtractExact, incrementExact,
* decrementExact, negateExact methods with {@code int} arguments.
*/
static void testIntegerExact() {
testIntegerExact(0, 0);
testIntegerExact(1, 1);
testIntegerExact(1, -1);
testIntegerExact(-1, 1);
testIntegerExact(1000, 2000);
testIntegerExact(Integer.MIN_VALUE, Integer.MIN_VALUE);
testIntegerExact(Integer.MAX_VALUE, Integer.MAX_VALUE);
testIntegerExact(Integer.MIN_VALUE, 1);
testIntegerExact(Integer.MAX_VALUE, 1);
testIntegerExact(Integer.MIN_VALUE, 2);
testIntegerExact(Integer.MAX_VALUE, 2);
testIntegerExact(Integer.MIN_VALUE, -1);
testIntegerExact(Integer.MAX_VALUE, -1);
testIntegerExact(Integer.MIN_VALUE, -2);
testIntegerExact(Integer.MAX_VALUE, -2);
}
/**
* Test exact arithmetic by comparing with the same operations using long
* and checking that the result is the same as the integer truncation.
* Errors are reported with {@link fail}.
*
* @param x first parameter
* @param y second parameter
*/
static void testIntegerExact(int x, int y) {
try {
// Test addExact
int sum = StrictMath.addExact(x, y);
long sum2 = (long) x + (long) y;
if ((int) sum2 != sum2) {
fail("FAIL: int StrictMath.addExact(" + x + " + " + y + ") = " + sum + "; expected Arithmetic exception");
} else if (sum != sum2) {
fail("FAIL: long StrictMath.addExact(" + x + " + " + y + ") = " + sum + "; expected: " + sum2);
}
} catch (ArithmeticException ex) {
long sum2 = (long) x + (long) y;
if ((int) sum2 == sum2) {
fail("FAIL: int StrictMath.addExact(" + x + " + " + y + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test subtractExact
int diff = StrictMath.subtractExact(x, y);
long diff2 = (long) x - (long) y;
if ((int) diff2 != diff2) {
fail("FAIL: int StrictMath.subtractExact(" + x + " - " + y + ") = " + diff + "; expected: " + diff2);
}
} catch (ArithmeticException ex) {
long diff2 = (long) x - (long) y;
if ((int) diff2 == diff2) {
fail("FAIL: int StrictMath.subtractExact(" + x + " - " + y + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test multiplyExact
int product = StrictMath.multiplyExact(x, y);
long m2 = (long) x * (long) y;
if ((int) m2 != m2) {
fail("FAIL: int StrictMath.multiplyExact(" + x + " * " + y + ") = " + product + "; expected: " + m2);
}
} catch (ArithmeticException ex) {
long m2 = (long) x * (long) y;
if ((int) m2 == m2) {
fail("FAIL: int StrictMath.multiplyExact(" + x + " * " + y + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test incrementExact
int inc = StrictMath.incrementExact(x);
long inc2 = (long) x + 1L;
if ((int) inc2 != inc2) {
fail("FAIL: int StrictMath.incrementExact(" + x + ") = " + inc + "; expected Arithmetic exception");
} else if (inc != inc2) {
fail("FAIL: long StrictMath.incrementExact(" + x + ") = " + inc + "; expected: " + inc2);
}
} catch (ArithmeticException ex) {
long inc2 = (long) x + 1L;
if ((int) inc2 == inc2) {
fail("FAIL: int StrictMath.incrementExact(" + x + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test decrementExact
int dec = StrictMath.decrementExact(x);
long dec2 = (long) x - 1L;
if ((int) dec2 != dec2) {
fail("FAIL: int StrictMath.decrementExact(" + x + ") = " + dec + "; expected Arithmetic exception");
} else if (dec != dec2) {
fail("FAIL: long StrictMath.decrementExact(" + x + ") = " + dec + "; expected: " + dec2);
}
} catch (ArithmeticException ex) {
long dec2 = (long) x - 1L;
if ((int) dec2 == dec2) {
fail("FAIL: int StrictMath.decrementExact(" + x + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test negateExact
int neg = StrictMath.negateExact(x);
long neg2 = -((long)x);
if ((int) neg2 != neg2) {
fail("FAIL: int StrictMath.negateExact(" + x + ") = " + neg + "; expected Arithmetic exception");
} else if (neg != neg2) {
fail("FAIL: long StrictMath.negateExact(" + x + ") = " + neg + "; expected: " + neg2);
}
} catch (ArithmeticException ex) {
long neg2 = -((long)x);
if ((int) neg2 == neg2) {
fail("FAIL: int StrictMath.negateExact(" + x + ")" + "; Unexpected exception: " + ex);
}
}
}
/**
* Test StrictMath.addExact, multiplyExact, subtractExact, incrementExact,
* decrementExact, negateExact, toIntExact methods with {@code long} arguments.
*/
static void testLongExact() {
testLongExactTwice(0, 0);
testLongExactTwice(1, 1);
testLongExactTwice(1, -1);
testLongExactTwice(1000, 2000);
testLongExactTwice(Long.MIN_VALUE, Long.MIN_VALUE);
testLongExactTwice(Long.MAX_VALUE, Long.MAX_VALUE);
testLongExactTwice(Long.MIN_VALUE, 1);
testLongExactTwice(Long.MAX_VALUE, 1);
testLongExactTwice(Long.MIN_VALUE, 2);
testLongExactTwice(Long.MAX_VALUE, 2);
testLongExactTwice(Long.MIN_VALUE, -1);
testLongExactTwice(Long.MAX_VALUE, -1);
testLongExactTwice(Long.MIN_VALUE, -2);
testLongExactTwice(Long.MAX_VALUE, -2);
testLongExactTwice(Long.MIN_VALUE/2, 2);
testLongExactTwice(Long.MAX_VALUE, 2);
testLongExactTwice(Integer.MAX_VALUE, Integer.MAX_VALUE);
testLongExactTwice(Integer.MAX_VALUE, -Integer.MAX_VALUE);
testLongExactTwice(Integer.MAX_VALUE+1, Integer.MAX_VALUE+1);
testLongExactTwice(Integer.MAX_VALUE+1, -Integer.MAX_VALUE+1);
testLongExactTwice(Integer.MIN_VALUE-1, Integer.MIN_VALUE-1);
testLongExactTwice(Integer.MIN_VALUE-1, -Integer.MIN_VALUE-1);
testLongExactTwice(Integer.MIN_VALUE/2, 2);
}
/**
* Test each of the exact operations with the arguments and
* with the arguments reversed.
* @param x
* @param y
*/
static void testLongExactTwice(long x, long y) {
testLongExact(x, y);
testLongExact(y, x);
}
/**
* Test long exact arithmetic by comparing with the same operations using BigInteger
* and checking that the result is the same as the long truncation.
* Errors are reported with {@link fail}.
*
* @param x first parameter
* @param y second parameter
*/
static void testLongExact(long x, long y) {
BigInteger resultBig = null;
final BigInteger xBig = BigInteger.valueOf(x);
final BigInteger yBig = BigInteger.valueOf(y);
try {
// Test addExact
resultBig = xBig.add(yBig);
long sum = StrictMath.addExact(x, y);
checkResult("long StrictMath.addExact", x, y, sum, resultBig);
} catch (ArithmeticException ex) {
if (inLongRange(resultBig)) {
fail("FAIL: long StrictMath.addExact(" + x + " + " + y + "); Unexpected exception: " + ex);
}
}
try {
// Test subtractExact
resultBig = xBig.subtract(yBig);
long diff = StrictMath.subtractExact(x, y);
checkResult("long StrictMath.subtractExact", x, y, diff, resultBig);
} catch (ArithmeticException ex) {
if (inLongRange(resultBig)) {
fail("FAIL: long StrictMath.subtractExact(" + x + " - " + y + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test multiplyExact
resultBig = xBig.multiply(yBig);
long product = StrictMath.multiplyExact(x, y);
checkResult("long StrictMath.multiplyExact", x, y, product, resultBig);
} catch (ArithmeticException ex) {
if (inLongRange(resultBig)) {
fail("FAIL: long StrictMath.multiplyExact(" + x + " * " + y + ")" + "; Unexpected exception: " + ex);
}
}
try {
// Test incrementExact
resultBig = xBig.add(BigInteger.ONE);
long inc = StrictMath.incrementExact(x);
checkResult("long Math.incrementExact", x, 1L, inc, resultBig);
} catch (ArithmeticException ex) {
if (inLongRange(resultBig)) {
fail("FAIL: long Math.incrementExact(" + x + "); Unexpected exception: " + ex);
}
}
try {
// Test decrementExact
resultBig = xBig.subtract(BigInteger.ONE);
long dec = StrictMath.decrementExact(x);
checkResult("long Math.decrementExact", x, 1L, dec, resultBig);
} catch (ArithmeticException ex) {
if (inLongRange(resultBig)) {
fail("FAIL: long Math.decrementExact(" + x + "); Unexpected exception: " + ex);
}
}
try {
// Test negateExact
resultBig = xBig.negate();
long dec = StrictMath.negateExact(x);
checkResult("long Math.negateExact", x, 0L, dec, resultBig);
} catch (ArithmeticException ex) {
if (inLongRange(resultBig)) {
fail("FAIL: long Math.negateExact(" + x + "); Unexpected exception: " + ex);
}
}
try {
// Test toIntExact
int value = StrictMath.toIntExact(x);
if ((long)value != x) {
fail("FAIL: " + "long StrictMath.toIntExact" + "(" + x + ") = " + value + "; expected an arithmetic exception: ");
}
} catch (ArithmeticException ex) {
if (resultBig.bitLength() <= 32) {
fail("FAIL: long StrictMath.toIntExact(" + x + ")" + "; Unexpected exception: " + ex);
}
}
}
/**
* Compare the expected and actual results.
* @param message message for the error
* @param x first argument
* @param y second argument
* @param result actual result value
* @param expected expected result value
*/
static void checkResult(String message, long x, long y, long result, BigInteger expected) {
BigInteger resultBig = BigInteger.valueOf(result);
if (!inLongRange(expected)) {
fail("FAIL: " + message + "(" + x + ", " + y + ") = " + result + "; expected an arithmetic exception: ");
} else if (!resultBig.equals(expected)) {
fail("FAIL: " + message + "(" + x + ", " + y + ") = " + result + "; expected " + expected);
}
}
/**
* Check if the value fits in 64 bits (a long).
* @param value
* @return true if the value fits in 64 bits (including the sign).
*/
static boolean inLongRange(BigInteger value) {
return value.bitLength() <= 63;
}
}

View file

@ -0,0 +1,178 @@
/*
* Copyright (c) 2023, 2026, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8301833 8302026 8301444 8302028 8302040 8302027 8304028
* @build Tests
* @build FdlibmTranslit
* @build ExhaustingTests
* @run main ExhaustingTests
* @summary Compare StrictMath.foo and FdlibmTranslit.foo for many inputs.
*/
/*
* Note on usage: for more exhaustive testing to help validate changes
* to StrictMath, the DEFAULT_SHIFT setting should be set to 0. This
* will test all float values against the unary methods. Running all
* the float values for a single method takes on the order of a minute
* or two. The default setting is a shift of 10, meaning every 1024th
* float value is tested and the overall test runs within the typical
* time expectations of a tier 1 test.
*/
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleUnaryOperator;
public class ExhaustingTests {
public static void main(String... args) {
long failures = 0;
failures += testUnaryMethods();
failures += testBinaryMethods();
if (failures > 0) {
System.err.println("Comparing StrictMath and FdlibmTranslit"
+ " incurred " + failures + " failures.");
throw new RuntimeException();
}
}
private static final int DEFAULT_SHIFT = 10;
/**
* Test the unary (one-argument) StrictMath methods from FDLIBM.
*/
private static long testUnaryMethods() {
long failures = 0;
UnaryTestCase[] testCases = {
// Since sqrt is correctly rounded and thus for each input
// there is one well-defined correct result, additional
// comparison of the transliteration sqrt or StrictMath
// sqrt could be made against Math::sqrt.
new UnaryTestCase("sqrt", FdlibmTranslit::sqrt, StrictMath::sqrt, DEFAULT_SHIFT),
new UnaryTestCase("cbrt", FdlibmTranslit::cbrt, StrictMath::cbrt, DEFAULT_SHIFT),
new UnaryTestCase("log", FdlibmTranslit::log, StrictMath::log, DEFAULT_SHIFT),
new UnaryTestCase("log10", FdlibmTranslit::log10, StrictMath::log10, DEFAULT_SHIFT),
new UnaryTestCase("log1p", FdlibmTranslit::log1p, StrictMath::log1p, DEFAULT_SHIFT),
new UnaryTestCase("exp", FdlibmTranslit::exp, StrictMath::exp, DEFAULT_SHIFT),
new UnaryTestCase("expm1", FdlibmTranslit::expm1, StrictMath::expm1, DEFAULT_SHIFT),
new UnaryTestCase("sinh", FdlibmTranslit::sinh, StrictMath::sinh, DEFAULT_SHIFT),
new UnaryTestCase("cosh", FdlibmTranslit::cosh, StrictMath::cosh, DEFAULT_SHIFT),
new UnaryTestCase("tanh", FdlibmTranslit::tanh, StrictMath::tanh, DEFAULT_SHIFT),
new UnaryTestCase("sin", FdlibmTranslit::sin, StrictMath::sin, DEFAULT_SHIFT),
new UnaryTestCase("cos", FdlibmTranslit::cos, StrictMath::cos, DEFAULT_SHIFT),
new UnaryTestCase("tan", FdlibmTranslit::tan, StrictMath::tan, DEFAULT_SHIFT),
new UnaryTestCase("asin", FdlibmTranslit::asin, StrictMath::asin, DEFAULT_SHIFT),
new UnaryTestCase("acos", FdlibmTranslit::acos, StrictMath::acos, DEFAULT_SHIFT),
new UnaryTestCase("atan", FdlibmTranslit::atan, StrictMath::atan, DEFAULT_SHIFT),
new UnaryTestCase("asinh", FdlibmTranslit::asinh, StrictMath::asinh, DEFAULT_SHIFT),
new UnaryTestCase("acosh", FdlibmTranslit::acosh, StrictMath::acosh, DEFAULT_SHIFT),
new UnaryTestCase("atanh", FdlibmTranslit::atanh, StrictMath::atanh, DEFAULT_SHIFT),
};
for (var testCase : testCases) {
System.out.println("Testing " + testCase.name());
System.out.flush();
int i = Integer.MAX_VALUE; // overflow to Integer.MIN_VALUE at start of loop
int increment = 1 << testCase.shiftDistance;
do {
i += increment;
double input = (double)Float.intBitsToFloat(i);
failures += Tests.test(testCase.name(),
input,
testCase.strictMath,
testCase.translit.applyAsDouble(input));
} while (i != Integer.MAX_VALUE);
}
return failures;
}
private static record UnaryTestCase(String name,
DoubleUnaryOperator translit,
DoubleUnaryOperator strictMath,
int shiftDistance) {
UnaryTestCase {
if (shiftDistance < 0 || shiftDistance >= 31) {
throw new IllegalArgumentException("Shift out of range");
}
}
}
/**
* Test the binary (two-argument) StrictMath methods from FDLIBM.
*/
private static long testBinaryMethods() {
long failures = 0;
// Note: pow does _not_ have a transliteration port.
// Shift of 16 for a binary method gives comparable running
// time to exhaustive testing of a unary method (testing every
// 2^16 floating point values over two arguments is 2^32
// probes).
BinaryTestCase[] testCases = {
new BinaryTestCase("hypot", FdlibmTranslit::hypot, StrictMath::hypot, 20, 20),
new BinaryTestCase("atan2", FdlibmTranslit::atan2, StrictMath::atan2, 20, 20),
new BinaryTestCase("IEEEremainder", FdlibmTranslit::IEEEremainder, StrictMath::IEEEremainder, 20, 20),
};
for (var testCase : testCases) {
System.out.println("Testing " + testCase.name());
System.out.flush();
int iIncrement = 1 << testCase.xShift;
int jIncrement = 1 << testCase.yShift;
for (long i = Integer.MIN_VALUE; i <= Integer.MAX_VALUE; i += iIncrement) {
for (long j = Integer.MIN_VALUE; j <= Integer.MAX_VALUE; j += jIncrement) {
double input1 = (double)Float.intBitsToFloat((int)i);
double input2 = (double)Float.intBitsToFloat((int)j);
failures += Tests.test(testCase.name(),
input1, input2,
testCase.strictMath,
testCase.translit.applyAsDouble(input1, input2));
}
}
}
return failures;
}
private static record BinaryTestCase(String name,
DoubleBinaryOperator translit,
DoubleBinaryOperator strictMath,
int xShift,
int yShift) {
BinaryTestCase {
if (xShift < 0 || xShift >= 31 ||
yShift < 0 || yShift >= 31 ) {
throw new IllegalArgumentException("Shift out of range");
}
}
}
}

View file

@ -0,0 +1,159 @@
/*
* Copyright (c) 2015, 2025, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8139688 8362376
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build ExpTests
* @run main ExpTests
* @summary Tests specifically for StrictMath.exp
*/
import jdk.test.lib.RandomFactory;
/**
* The role of this test is to verify that the FDLIBM exp algorithm is
* being used by running golden file style tests on values that may
* vary from one conforming exponential implementation to another.
*/
public class ExpTests {
private ExpTests(){}
public static void main(String [] argv) {
int failures = 0;
failures += testExp();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing the exponential incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
// From the fdlibm source, the overflow threshold in hex is:
// 0x4086_2E42_FEFA_39EF.
static final double EXP_OVERFLOW_THRESH = Double.longBitsToDouble(0x4086_2E42_FEFA_39EFL);
// From the fdlibm source, the underflow threshold in hex is:
// 0xc087_4910_D52D_3051L.
static final double EXP_UNDERFLOW_THRESH = Double.longBitsToDouble(0xc087_4910_D52D_3051L);
static int testExp() {
int failures = 0;
double [][] testCases = {
// Some of these could be moved to common Math/StrictMath exp testing.
{Double.NaN, Double.NaN},
{Double.MAX_VALUE, Double.POSITIVE_INFINITY},
{Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY},
{Double.NEGATIVE_INFINITY, +0.0},
{EXP_OVERFLOW_THRESH, 0x1.ffff_ffff_fff2ap1023},
{Math.nextUp(EXP_OVERFLOW_THRESH), Double.POSITIVE_INFINITY},
{Math.nextDown(EXP_UNDERFLOW_THRESH), +0.0},
{EXP_UNDERFLOW_THRESH, +Double.MIN_VALUE},
// FDLIBM exp(1.0) does *not* return Math.E
{1.0, Math.nextUp(Math.E)},
// Cases observed to differ between FDLIBM and other implementations.
{+0x1.2e8f20cf3cbe7p+8, 0x1.6a2a59cc78bf8p436},
{-0x1.49f33ad2c1c58p+9, 0x1.f3ccc815431b6p-953},
{+0x1.fce66609f7428p+5, 0x1.b59724cb0bc4cp91},
{-0x1.49f33ad2c1c58p+9, 0x1.f3ccc815431b6p-953},
// Test values near 0.5*ln*(2) and 1.5*ln(2) to check refactoring
{0.34657359027997275, 1.4142135623730951},
{1.0397207708399183, 2.828427124746191},
};
for(double[] testCase: testCases)
failures+=testExpCase(testCase[0], testCase[1]);
return failures;
}
static int testExpCase(double input, double expected) {
int failures = 0;
failures+=Tests.test("StrictMath.exp(double)", input,
StrictMath.exp(input), expected);
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.exp against transliteration port of exp.
*/
private static int testAgainstTranslit() {
int failures = 0;
double[] decisionPoints = {
// Near overflow threshold
EXP_OVERFLOW_THRESH - 512*Math.ulp(EXP_OVERFLOW_THRESH),
// Near underflow threshold
EXP_UNDERFLOW_THRESH - 512*Math.ulp(EXP_UNDERFLOW_THRESH),
// Straddle algorithm conditional checks
Double.longBitsToDouble(0x4086_2E42_0000_0000L - 512L),
Double.longBitsToDouble(0x3fd6_2e42_0000_0000L - 512L),
Double.longBitsToDouble(0x3FF0_A2B2_0000_0000L - 512L),
Double.longBitsToDouble(0x3e30_0000_0000_0000L - 512L),
// Other notable points
Double.MIN_NORMAL - Math.ulp(Double.MIN_NORMAL)*512,
-Double.MIN_VALUE*512,
};
for (double decisionPoint : decisionPoints) {
double ulp = Math.ulp(decisionPoint);
failures += testRange(decisionPoint - 1024*ulp, ulp, 1_024);
}
// Try out some random values
for (int i = 0; i < 100; i++) {
double x = Tests.createRandomDouble(random);
failures += testRange(x, Math.ulp(x), 100);
}
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testExpCase(x, FdlibmTranslit.exp(x));
}
return failures;
}
}

View file

@ -0,0 +1,881 @@
/*
* Copyright (c) 2003, 2024, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4851638 8301396
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build Expm1Tests
* @run main Expm1Tests
* @summary Tests for StrictMath.expm1
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/Expm1Tests.java test properties that should
* hold for any expm1 implementation, including the FDLIBM-based one
* required for StrictMath.expm1. Therefore, the test cases in
* ../Math/Expm1Tests.java are run against both the Math and
* StrictMath versions of expm1. The role of this test is to verify
* that the FDLIBM expm1 algorithm is being used by running golden
* file tests on values that may vary from one conforming expm1
* implementation to another.
*/
public class Expm1Tests {
private Expm1Tests(){}
public static void main(String... args) {
int failures = 0;
failures += testAgainstTranslit();
failures += testExpm1();
if (failures > 0) {
System.err.println("Testing expm1 incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.expm1 against transliteration port of expm1.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x;
// Test just above subnormal threshold...
x = Double.MIN_NORMAL;
failures += testRange(x, Math.ulp(x), 1000);
// ... and just below subnormal threshold ...
x = Math.nextDown(Double.MIN_NORMAL);
failures += testRange(x, -Math.ulp(x), 1000);
// ... and near 1.0 ...
failures += testRangeMidpoint(1.0, Math.ulp(x), 2000);
// (Note: probes every-other value less than 1.0 due to
// change in the size of an ulp at 1.0.
// Probe near decision points in the FDLIBM algorithm.
double LN2 = StrictMath.log(2.0);
double[] decisionPoints = {
7.09782712893383973096e+02, // overflow threshold
56.0 * LN2,
-56.0 * LN2,
0.5 * LN2,
-0.5 * LN2,
1.5 * LN2,
-1.5 * LN2,
0x1.0p-54,
-0x1.0p-54,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000);
}
x = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold. Don't worry about test
// elements overflowing to infinity if the starting value is
// near Double.MAX_VALUE.
failures += testRange(x, 2.0 * Math.ulp(x), 1000);
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testExpm1Case(x, FdlibmTranslit.expm1(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures += testExpm1Case(x, FdlibmTranslit.expm1(x));
}
return failures;
}
private static int testExpm1Case(double input, double expected) {
return Tests.test("StrictMath.expm1(double)", input,
StrictMath::expm1, expected);
}
private static int testExpm1() {
int failures = 0;
// Test cases in the range [-36.75, 710]
double [][] testCases = {
{-0x1.580000008c619p3, -0x1.fffd3069586f6p-1},
{-0x1.380000008c721p3, -0x1.fff85bf4a6e98p-1},
{-0x1.180000008c9fap3, -0x1.ffeb3aeb95524p-1},
{-0x1.f0000001197ccp2, -0x1.ffc78aadc116ap-1},
{-0x1.b0000001197e7p2, -0x1.ff6687cca710bp-1},
{-0x1.70000001197f6p2, -0x1.fe5ed3992a519p-1},
{-0x1.30000001198p2, -0x1.fb9201482bdfap-1},
{-0x1.e000000233006p1, -0x1.f3f57b658d6fbp-1},
{-0x1.6000000233012p1, -0x1.df44d8ee30b76p-1},
{-0x1.c000000466028p0, -0x1.a7071a097ed5ep-1},
{-0x1.80000008cc052p-1, -0x1.0e25f8a4a95b7p-1},
{0x1.ffffffdccfeb7p-3, 0x1.22d78ef909144p-2},
{0x1.3ffffffb99fd7p0, 0x1.3ec38ed3629a6p1},
{0x1.1ffffffdccfebp1, 0x1.0f9b882a107edp3},
{0x1.9ffffffdccfebp1, 0x1.8ca53b70fa11bp4},
{0x1.0ffffffee67f6p2, 0x1.146bf132050c5p6},
{0x1.4ffffffee67f5p2, 0x1.7b21ede9f0bdap7},
{0x1.8ffffffee67f5p2, 0x1.0281a438aa523p9},
{0x1.cffffffee67f5p2, 0x1.5fc6b5cf322c4p10},
{0x1.07ffffff733fap3, 0x1.de5406b276b92p11},
{0x1.27ffffff733fap3, 0x1.451c8690d1567p13},
{0x1.47ffffff733fap3, 0x1.b9e62ae5924dfp14},
{0x1.67ffffff733fap3, 0x1.2c4eeb7089cp16},
{0x1.87ffffff733fap3, 0x1.982a24f2ab78ap17},
{0x1.a7ffffff733fap3, 0x1.1560a14319349p19},
{0x1.c7ffffff733fap3, 0x1.78fed772b40f2p20},
{0x1.e7ffffff733fap3, 0x1.0031f18ee602fp22},
{0x1.03ffffffb99fdp4, 0x1.5c348d8118f26p23},
{0x1.13ffffffb99fdp4, 0x1.d942943e22d74p24},
{0x1.23ffffffb99fcp4, 0x1.419d1309466ep26},
{0x1.33ffffffb99fcp4, 0x1.b51e403430afep27},
{0x1.43ffffffb99fcp4, 0x1.290d76c47bd4cp29},
{0x1.53ffffffb99fcp4, 0x1.93bc8061146dp30},
{0x1.63ffffffb99fbp4, 0x1.125e0665544a5p32},
{0x1.73ffffffb99fbp4, 0x1.74e75f9de5d7cp33},
{0x1.83ffffffb99fbp4, 0x1.fad42d3f28732p34},
{0x1.93ffffffb99fbp4, 0x1.586d071cb8f87p36},
{0x1.a3ffffffb99fbp4, 0x1.d41f91d0b4e6ep37},
{0x1.b3ffffffb99fbp4, 0x1.3e1f6e5bc0242p39},
{0x1.c3ffffffb99fbp4, 0x1.b05fa9aebfa64p40},
{0x1.d3ffffffb99fbp4, 0x1.25d410cc90a38p42},
{0x1.e3ffffffb99fbp4, 0x1.8f5aab33aa6c6p43},
{0x1.f3ffffffb99fbp4, 0x1.0f63a91bc9797p45},
{0x1.01ffffffdccfep5, 0x1.70db367c88b28p46},
{0x1.09ffffffdccfep5, 0x1.f553e36d2975fp47},
{0x1.11ffffffdccfep5, 0x1.54afff2230e99p49},
{0x1.19ffffffdccfep5, 0x1.cf0ad451f1e9fp50},
{0x1.21ffffffdccfep5, 0x1.3aab7c88ef991p52},
{0x1.29ffffffdccfep5, 0x1.abae41ecccd22p53},
{0x1.31ffffffdccfep5, 0x1.22a3a0462535fp55},
{0x1.39ffffffdccfdp5, 0x1.8b050329f95c8p56},
{0x1.41ffffffdccfdp5, 0x1.0c719224d80a2p58},
{0x1.49ffffffdccfdp5, 0x1.6cda4c755ea56p59},
{0x1.51ffffffdccfdp5, 0x1.efe2e2b6ad6ebp60},
{0x1.59ffffffdccfdp5, 0x1.50fd5a6337c61p62},
{0x1.61ffffffdccfdp5, 0x1.ca043518d78acp63},
{0x1.69ffffffdccfdp5, 0x1.374122dd2fbdbp65},
{0x1.71ffffffdccfdp5, 0x1.a709e46cc671ep66},
{0x1.79ffffffdccfdp5, 0x1.1f7c0c5482bf3p68},
{0x1.81ffffffdccfdp5, 0x1.86bb667297515p69},
{0x1.89ffffffdccfcp5, 0x1.0987aa8375abcp71},
{0x1.91ffffffdccfcp5, 0x1.68e48248f27ddp72},
{0x1.99ffffffdccfcp5, 0x1.ea8100a2e27e9p73},
{0x1.a1ffffffdccfcp5, 0x1.4d54fc02d9352p75},
{0x1.a9ffffffdccfcp5, 0x1.c50b8ceab6ad1p76},
{0x1.b1ffffffdccfcp5, 0x1.33e046afc7062p78},
{0x1.b9ffffffdccfcp5, 0x1.a2726cf2e78e3p79},
{0x1.c1ffffffdccfcp5, 0x1.1c5d3c581edf2p81},
{0x1.c9ffffffdccfcp5, 0x1.827db3961daecp82},
{0x1.d1ffffffdccfbp5, 0x1.06a5db797b4b2p84},
{0x1.d9ffffffdccfbp5, 0x1.64f9b90e23fb4p85},
{0x1.e1ffffffdccfbp5, 0x1.e52e132ebafe2p86},
{0x1.e9ffffffdccfbp5, 0x1.49b6c774442efp88},
{0x1.f1ffffffdccfbp5, 0x1.c020b4f9d926cp89},
{0x1.f9ffffffdccfbp5, 0x1.3088cda20d465p91},
{0x1.00ffffffee67ep6, 0x1.9de7b7a818186p92},
{0x1.04ffffffee67ep6, 0x1.194717f5da259p94},
{0x1.08ffffffee67ep6, 0x1.7e4bc97a2360dp95},
{0x1.0cffffffee67ep6, 0x1.03cc0e87f367bp97},
{0x1.10ffffffee67ep6, 0x1.6119d231b67f5p98},
{0x1.14ffffffee67ep6, 0x1.dfe9f0cbe5942p99},
{0x1.18ffffffee67ep6, 0x1.4622a079fc2a6p101},
{0x1.1cffffffee67ep6, 0x1.bb4386e45ae94p102},
{0x1.20ffffffee67ep6, 0x1.2d3a9d9e9fe6p104},
{0x1.24ffffffee67ep6, 0x1.9969a118d6261p105},
{0x1.28ffffffee67ep6, 0x1.1639871642331p107},
{0x1.2cffffffee67ep6, 0x1.7a2587603a84bp108},
{0x1.30ffffffee67ep6, 0x1.00fa2d6e6a76ep110},
{0x1.34ffffffee67ep6, 0x1.5d44af7562574p111},
{0x1.38ffffffee67ep6, 0x1.dab4705f88c02p112},
{0x1.3cffffffee67ep6, 0x1.42986b24fc9dcp114},
{0x1.40ffffffee67ep6, 0x1.b673dcb2fe519p115},
{0x1.44ffffffee67ep6, 0x1.29f59cd896383p117},
{0x1.48ffffffee67ep6, 0x1.94f806342143cp118},
{0x1.4cffffffee67ep6, 0x1.133471e4d5b38p120},
{0x1.50ffffffee67ep6, 0x1.760acce4f0e03p121},
{0x1.54ffffffee67ep6, 0x1.fc604454828ddp122},
{0x1.58ffffffee67ep6, 0x1.597a32eee8c46p124},
{0x1.5cffffffee67ep6, 0x1.d58d694102246p125},
{0x1.60ffffffee67ep6, 0x1.3f180bd3df0d2p127},
{0x1.64ffffffee67ep6, 0x1.b1b190d803f07p128},
{0x1.68ffffffee67ep6, 0x1.26b9b1cab82dap130},
{0x1.6cffffffee67ep6, 0x1.9092c44a68bc1p131},
{0x1.70ffffffee67ep6, 0x1.1037c0cf4a5a6p133},
{0x1.74ffffffee67ep6, 0x1.71fb79fed30fbp134},
{0x1.78ffffffee67ep6, 0x1.f6dbadec024eep135},
{0x1.7cffffffee67ep6, 0x1.55ba3f072a6dbp137},
{0x1.80ffffffee67ep6, 0x1.d074b338a9163p138},
{0x1.84ffffffee67ep6, 0x1.3ba167320351ap140},
{0x1.88ffffffee67ep6, 0x1.acfc7e2e0558bp141},
{0x1.8cffffffee67ep6, 0x1.2386c336b7163p143},
{0x1.90ffffffee67ep6, 0x1.8c39b90c7cdap144},
{0x1.94ffffffee67ep6, 0x1.0d435c84d4e66p146},
{0x1.98ffffffee67ep6, 0x1.6df76efd7275ep147},
{0x1.9cffffffee67ep6, 0x1.f1666c9163f86p148},
{0x1.a0ffffffee67ep6, 0x1.5204b679406b7p150},
{0x1.a4ffffffee67ep6, 0x1.cb6a267e94b7ap151},
{0x1.a8ffffffee67ep6, 0x1.38346236ba483p153},
{0x1.acffffffee67ep6, 0x1.a8547ff6d3311p154},
{0x1.b0ffffffee67ep6, 0x1.205cb8246899ap156},
{0x1.b4ffffffee67ep6, 0x1.87ecc28a831c1p157},
{0x1.b8ffffffee67ep6, 0x1.0a572df57323ep159},
{0x1.bcffffffee67ep6, 0x1.69fe8c886de24p160},
{0x1.c0ffffffee67ep6, 0x1.ec0055aa644acp161},
{0x1.c4ffffffee67ep6, 0x1.4e597c5197d13p163},
{0x1.c8ffffffee67ep6, 0x1.c66d9bb965746p164},
{0x1.ccffffffee67ep6, 0x1.34d0e22472ce2p166},
{0x1.d0ffffffee67ep6, 0x1.a3b971da5668ap167},
{0x1.d4ffffffee67ep6, 0x1.1d3b77e103d1ap169},
{0x1.d8ffffffee67ep6, 0x1.83abbf32ed4f6p170},
{0x1.dcffffffee67ep6, 0x1.07731e5137e95p172},
{0x1.e0ffffffee67ep6, 0x1.6610b39e7ce7p173},
{0x1.e4ffffffee67ep6, 0x1.e6a93f132076cp174},
{0x1.e8ffffffee67ep6, 0x1.4ab873ed0fb2cp176},
{0x1.ecffffffee67ep6, 0x1.c17eebfd11debp177},
{0x1.f0ffffffee67ep6, 0x1.3176cc87e9082p179},
{0x1.f4ffffffee67ep6, 0x1.9f2b2fe57487ap180},
{0x1.f8ffffffee67ep6, 0x1.1a22e9fe60816p182},
{0x1.fcffffffee67ep6, 0x1.7f768dd1738aap183},
{0x1.007ffffff733fp7, 0x1.049717079907bp185},
{0x1.027ffffff733fp7, 0x1.622dc5947dd63p186},
{0x1.047ffffff733fp7, 0x1.e160ff1ccd30cp187},
{0x1.067ffffff733fp7, 0x1.472180f8199d7p189},
{0x1.087ffffff733fp7, 0x1.bc9df0c9b6e0fp190},
{0x1.0a7ffffff733fp7, 0x1.2e26073757ed6p192},
{0x1.0c7ffffff733fp7, 0x1.9aa99688f714bp193},
{0x1.0e7ffffff733fp7, 0x1.1712f6523864dp195},
{0x1.107ffffff733fp7, 0x1.7b4d0d8e11012p196},
{0x1.127ffffff733fp7, 0x1.01c301c6bf29cp198},
{0x1.147ffffff733fp7, 0x1.5e55a41486608p199},
{0x1.167ffffff733fp7, 0x1.dc276c8c7156p200},
{0x1.187ffffff733fp7, 0x1.4394876ddc7dap202},
{0x1.1a7ffffff733fp7, 0x1.b7ca840a6b3bap203},
{0x1.1c7ffffff733fp7, 0x1.2ade7851ad0fep205},
{0x1.1e7ffffff733fp7, 0x1.963482987606p206},
{0x1.207ffffff733fp7, 0x1.140b84f56a91bp208},
{0x1.227ffffff733fp7, 0x1.772f1dec03a66p209},
{0x1.247ffffff733fp7, 0x1.fded90f5af3ap210},
{0x1.267ffffff733fp7, 0x1.5a88311cf6cbdp212},
{0x1.287ffffff733fp7, 0x1.d6fc5e99a419dp213},
{0x1.2a7ffffff733fp7, 0x1.40116b9759ebap215},
{0x1.2c7ffffff733fp7, 0x1.b304801416466p216},
{0x1.2e7ffffff733fp7, 0x1.27a0063dbe9cep218},
{0x1.307ffffff733fp7, 0x1.91cbd14945353p219},
{0x1.327ffffff733fp7, 0x1.110c7e4340e4fp221},
{0x1.347ffffff733fp7, 0x1.731c9ec8ce996p222},
{0x1.367ffffff733fp7, 0x1.f864aa9acffbdp223},
{0x1.387ffffff733fp7, 0x1.56c54eff8fbcdp225},
{0x1.3a7ffffff733fp7, 0x1.d1dfaced4eb1p226},
{0x1.3c7ffffff733fp7, 0x1.3c98120a95d78p228},
{0x1.3e7ffffff733fp7, 0x1.ae4bbfa449eaap229},
{0x1.407ffffff733fp7, 0x1.246a97a9838dcp231},
{0x1.427ffffff733fp7, 0x1.8d6f603164cebp232},
{0x1.447ffffff733fp7, 0x1.0e15cad8b775ep234},
{0x1.467ffffff733fp7, 0x1.6f15705b3f514p235},
{0x1.487ffffff733fp7, 0x1.f2eb25494787dp236},
{0x1.4a7ffffff733fp7, 0x1.530ce0608a8acp238},
{0x1.4c7ffffff733fp7, 0x1.ccd12fa07172p239},
{0x1.4e7ffffff733fp7, 0x1.39285fa9c08e7p241},
{0x1.507ffffff733fp7, 0x1.a9a01de01fd02p242},
{0x1.527ffffff733fp7, 0x1.213e13894e05p244},
{0x1.547ffffff733fp7, 0x1.891f0d4674b33p245},
{0x1.567ffffff733fp7, 0x1.0b275393c60b2p247},
{0x1.587ffffff733fp7, 0x1.6b1973327581dp248},
{0x1.5a7ffffff733fp7, 0x1.ed80d645874cfp249},
{0x1.5c7ffffff733fp7, 0x1.4f5ec835b4172p251},
{0x1.5e7ffffff733fp7, 0x1.c7d0bf3aec5fcp252},
{0x1.607ffffff733fp7, 0x1.35c239a263125p254},
{0x1.627ffffff733fp7, 0x1.a501765319bp255},
{0x1.647ffffff733fp7, 0x1.1e1a611707cfbp257},
{0x1.667ffffff733fp7, 0x1.84dab6dcaac3cp258},
{0x1.687ffffff733fp7, 0x1.08410192ab89ep260},
{0x1.6a7ffffff733fp7, 0x1.67288834edb2fp261},
{0x1.6c7ffffff733fp7, 0x1.e825934abdad9p262},
{0x1.6e7ffffff733fp7, 0x1.4bbae9c58a222p264},
{0x1.707ffffff733fp7, 0x1.c2de34b24b161p265},
{0x1.727ffffff733fp7, 0x1.3265856c8dbdcp267},
{0x1.747ffffff733fp7, 0x1.a06fa4ee04c8ep268},
{0x1.767ffffff733fp7, 0x1.1aff67d171068p270},
{0x1.787ffffff733fp7, 0x1.80a23ba5cc0fep271},
{0x1.7a7ffffff733fp7, 0x1.0562be333b5b6p273},
{0x1.7c7ffffff733fp7, 0x1.6342909f8e806p274},
{0x1.7e7ffffff733fp7, 0x1.e2d932898c11cp275},
{0x1.807ffffff733ep7, 0x1.482128a65b0aap277},
{0x1.827ffffff733ep7, 0x1.bdf9696894p278},
{0x1.847ffffff733ep7, 0x1.2f1228ca0924p280},
{0x1.867ffffff733ep7, 0x1.9bea8605e05b8p281},
{0x1.887ffffff733ep7, 0x1.17ed0f7b60befp283},
{0x1.8a7ffffff733ep7, 0x1.7c757ab028d2cp284},
{0x1.8c7ffffff733ep7, 0x1.028c73122cbaap286},
{0x1.8e7ffffff733ep7, 0x1.5f676e04b872p287},
{0x1.907ffffff733ep7, 0x1.dd9b8aa6c07f4p288},
{0x1.927ffffff733ep7, 0x1.449168bd6830bp290},
{0x1.947ffffff733ep7, 0x1.b922372b1b22fp291},
{0x1.967ffffff733ep7, 0x1.2bc809c589606p293},
{0x1.987ffffff733ep7, 0x1.9771f652c776ap294},
{0x1.9a7ffffff733ep7, 0x1.14e3401b07fc7p296},
{0x1.9c7ffffff733ep7, 0x1.785453659b7d4p297},
{0x1.9e7ffffff733ep7, 0x1.ff7c1414d829fp298},
{0x1.a07ffffff733ep7, 0x1.5b97024b58a63p300},
{0x1.a27ffffff733ep7, 0x1.d86c72ba13072p301},
{0x1.a47ffffff733ep7, 0x1.410b8e3e0a59p303},
{0x1.a67ffffff733ep7, 0x1.b458783157a34p304},
{0x1.a87ffffff733ep7, 0x1.28870eb1e33efp306},
{0x1.aa7ffffff733ep7, 0x1.9305d2eedd47p307},
{0x1.ac7ffffff733ep7, 0x1.11e1e1f93656cp309},
{0x1.ae7ffffff733ep7, 0x1.743ea58a8a142p310},
{0x1.b07ffffff733ep7, 0x1.f9eeda68dbff6p311},
{0x1.b27ffffff733ep7, 0x1.57d12fadfda18p313},
{0x1.b47ffffff733ep7, 0x1.d34bc24ce61e7p314},
{0x1.b67ffffff733ep7, 0x1.3d8f7da8d8d95p316},
{0x1.b87ffffff733ep7, 0x1.af9c071bbd116p317},
{0x1.ba7ffffff733ep7, 0x1.254f1e2943f7fp319},
{0x1.bc7ffffff733ep7, 0x1.8ea5f9553ce5ep320},
{0x1.be7ffffff733ep7, 0x1.0ee8dda0a100cp322},
{0x1.c07ffffff733ep7, 0x1.7034513ceac7dp323},
{0x1.c27ffffff733ep7, 0x1.f4710dcb08bdcp324},
{0x1.c47ffffff733ep7, 0x1.5415d8b9ef19cp326},
{0x1.c67ffffff733ep7, 0x1.ce3951590b045p327},
{0x1.c87ffffff733ep7, 0x1.3a1d1bcad2ec4p329},
{0x1.ca7ffffff733ep7, 0x1.aaecbef297a4ap330},
{0x1.cc7ffffff733ep7, 0x1.22201f0c6ae88p332},
{0x1.ce7ffffff733ep7, 0x1.8a524760ebdc1p333},
{0x1.d07ffffff733ep7, 0x1.0bf81bdd2ba52p335},
{0x1.d27ffffff733ep7, 0x1.6c3536f34b0c2p336},
{0x1.d47ffffff733ep7, 0x1.ef02835e6a7d8p337},
{0x1.d67ffffff733ep7, 0x1.5064e04e480fep339},
{0x1.d87ffffff733ep7, 0x1.c934f847894a8p340},
{0x1.da7ffffff733ep7, 0x1.36b44dbc8b633p342},
{0x1.dc7ffffff733ep7, 0x1.a64a7b24ebae2p343},
{0x1.de7ffffff733ep7, 0x1.1ef9f881e57b8p345},
{0x1.e07ffffff733ep7, 0x1.860a9b4bcf9dfp346},
{0x1.e27ffffff733ep7, 0x1.090f85bb33493p348},
{0x1.e47ffffff733ep7, 0x1.6841377bd96e9p349},
{0x1.e67ffffff733ep7, 0x1.e9a310bd2715dp350},
{0x1.e87ffffff733ep7, 0x1.4cbe299b1372dp352},
{0x1.ea7ffffff733ep7, 0x1.c43e8fef69d0dp353},
{0x1.ec7ffffff733ep7, 0x1.3354f8e156a72p355},
{0x1.ee7ffffff733ep7, 0x1.a1b51787582dfp356},
{0x1.f07ffffff733ep7, 0x1.1bdc91f54d333p358},
{0x1.f27ffffff733ep7, 0x1.81ced3ada5ec9p359},
{0x1.f47ffffff733ep7, 0x1.062f0486db268p361},
{0x1.f67ffffff733ep7, 0x1.645833fb72196p362},
{0x1.f87ffffff733ep7, 0x1.e4528bf7332d2p363},
{0x1.fa7ffffff733ep7, 0x1.492198206b3aep365},
{0x1.fc7ffffff733ep7, 0x1.bf55f194851b5p366},
{0x1.fe7ffffff733ep7, 0x1.2fff02e67affep368},
{0x1.003ffffffb99fp8, 0x1.9d2c7052fc80ep369},
{0x1.013ffffffb99fp8, 0x1.18c7d31687cep371},
{0x1.023ffffffb99fp8, 0x1.7d9ecf7b00132p372},
{0x1.033ffffffb99fp8, 0x1.035681cb5b766p374},
{0x1.043ffffffb99fp8, 0x1.607a0decadfaep375},
{0x1.053ffffffb99fp8, 0x1.df10cb910ae14p376},
{0x1.063ffffffb99fp8, 0x1.458f0fad99f57p378},
{0x1.073ffffffb99fp8, 0x1.ba7af6e654fa2p379},
{0x1.083ffffffb99fp8, 0x1.2cb251c2631d6p381},
{0x1.093ffffffb99fp8, 0x1.98b06224611f2p382},
{0x1.0a3ffffffb99fp8, 0x1.15bba3d909807p384},
{0x1.0b3ffffffb99fp8, 0x1.797a6e0440f8fp385},
{0x1.0c3ffffffb99fp8, 0x1.0085e752522ap387},
{0x1.0d3ffffffb99fp8, 0x1.5ca6a71ef489ep388},
{0x1.0e3ffffffb99fp8, 0x1.d9dda6826dfc7p389},
{0x1.0f3ffffffb99fp8, 0x1.420674603ebb2p391},
{0x1.103ffffffb99fp8, 0x1.b5ad79fec979p392},
{0x1.113ffffffb99fp8, 0x1.296ecbb3d2db7p394},
{0x1.123ffffffb99fp8, 0x1.9440c9fa6362ap395},
{0x1.133ffffffb99fp8, 0x1.12b7ec73193e4p397},
{0x1.143ffffffb99fp8, 0x1.75618ef49dffep398},
{0x1.153ffffffb99fp8, 0x1.fb7a3e462b12ap399},
{0x1.163ffffffb99fp8, 0x1.58dde1b590206p401},
{0x1.173ffffffb99fp8, 0x1.d4b8f4351faecp402},
{0x1.183ffffffb99fp8, 0x1.3e87aaa373892p404},
{0x1.193ffffffb99fp8, 0x1.b0ed5561210d9p405},
{0x1.1a3ffffffb99fp8, 0x1.263457411e3a5p407},
{0x1.1b3ffffffb99fp8, 0x1.8fdd8535244cdp408},
{0x1.1c3ffffffb99fp8, 0x1.0fbc955d170d1p410},
{0x1.1d3ffffffb99fp8, 0x1.7154125122a86p411},
{0x1.1e3ffffffb99fp8, 0x1.f5f8270411675p412},
{0x1.1f3ffffffb99fp8, 0x1.551fa026c4e4cp414},
{0x1.203ffffffb99fp8, 0x1.cfa28c83a9c15p415},
{0x1.213ffffffb99fp8, 0x1.3b12972ef5f7ap417},
{0x1.223ffffffb99fp8, 0x1.ac3a63f8c3fc9p418},
{0x1.233ffffffb99fp8, 0x1.2302db376285dp420},
{0x1.243ffffffb99fp8, 0x1.8b867194fa443p421},
{0x1.253ffffffb99fp8, 0x1.0cc98750c45aep423},
{0x1.263ffffffb99fp8, 0x1.6d51d877b6f1bp424},
{0x1.273ffffffb99fp8, 0x1.f0855ddfe3faap425},
{0x1.283ffffffb99fp8, 0x1.516bc53aea3aap427},
{0x1.293ffffffb99fp8, 0x1.ca9a47b823396p428},
{0x1.2a3ffffffb99fp8, 0x1.37a71f0652462p430},
{0x1.2b3ffffffb99fp8, 0x1.a794811822eb3p431},
{0x1.2c3ffffffb99fp8, 0x1.1fda3ea9c1a4fp433},
{0x1.2d3ffffffb99fp8, 0x1.873b6d3965cp434},
{0x1.2e3ffffffb99fp8, 0x1.09deab488e539p436},
{0x1.2f3ffffffb99fp8, 0x1.695ac21e2870ep437},
{0x1.303ffffffb99fp8, 0x1.eb21b852a647cp438},
{0x1.313ffffffb99fp8, 0x1.4dc2340b86b4cp440},
{0x1.323ffffffb99fp8, 0x1.c59ffe8afa62cp441},
{0x1.333ffffffb99fp8, 0x1.3445277810b78p443},
{0x1.343ffffffb99fp8, 0x1.a2fb88779894fp444},
{0x1.353ffffffb99fp8, 0x1.1cba68f09f8c5p446},
{0x1.363ffffffb99fp8, 0x1.82fc56a008db6p447},
{0x1.373ffffffb99fp8, 0x1.06fbea7eda2dfp449},
{0x1.383ffffffb99fp8, 0x1.656eb0513614ep450},
{0x1.393ffffffb99fp8, 0x1.e5cd0c4b86aaap451},
{0x1.3a3ffffffb99fp8, 0x1.4a22d0026e7ffp453},
{0x1.3b3ffffffb99fp8, 0x1.c0b38a21c236cp454},
{0x1.3c3ffffffb99fp8, 0x1.30ec961ce5379p456},
{0x1.3d3ffffffb99fp8, 0x1.9e6f56344e9dp457},
{0x1.3e3ffffffb99fp8, 0x1.19a341a8e1ccbp459},
{0x1.3f3ffffffb99fp8, 0x1.7ec90ca3a1c6dp460},
{0x1.403ffffffb99fp8, 0x1.04212e6d536d6p462},
{0x1.413ffffffb99fp8, 0x1.618d84739e91cp463},
{0x1.423ffffffb99fp8, 0x1.e087302e9607ap464},
{0x1.433ffffffb99fp8, 0x1.468d7cd8e4417p466},
{0x1.443ffffffb99fp8, 0x1.bbd4c40e0317cp467},
{0x1.453ffffffb99fp8, 0x1.2d9d50d6e1436p469},
{0x1.463ffffffb99fp8, 0x1.99efc6cf25729p470},
{0x1.473ffffffb99fp8, 0x1.1694b0b33138ap472},
{0x1.483ffffffb99fp8, 0x1.7aa16e7b0810dp473},
{0x1.493ffffffb99fp8, 0x1.014e60cc3c10bp475},
{0x1.4a3ffffffb99fp8, 0x1.5db7203d316b3p476},
{0x1.4b3ffffffb99fp8, 0x1.db4ffad383047p477},
{0x1.4c3ffffffb99fp8, 0x1.43021e96bc60ep479},
{0x1.4d3ffffffb99fp8, 0x1.b703864c0ed74p480},
{0x1.4e3ffffffb99fp8, 0x1.2a573dd0a80e6p482},
{0x1.4f3ffffffb99fp8, 0x1.957cb72b9f3f6p483},
{0x1.503ffffffb99fp8, 0x1.138e9e333d9afp485},
{0x1.513ffffffb99fp8, 0x1.76855bb82cbcep486},
{0x1.523ffffffb99fp8, 0x1.fd06d7237d52bp487},
{0x1.533ffffffb99fp8, 0x1.59eb65b9e296ap489},
{0x1.543ffffffb99fp8, 0x1.d627438458c6ap490},
{0x1.553ffffffb99fp8, 0x1.3f80999182b7ap492},
{0x1.563ffffffb99fp8, 0x1.b23fab41d7fcdp493},
{0x1.573ffffffb99fp8, 0x1.271a437ca4dd9p495},
{0x1.583ffffffb99fp8, 0x1.9116048ecdd82p496},
{0x1.593ffffffb99fp8, 0x1.1090f28f03784p498},
{0x1.5a3ffffffb99fp8, 0x1.7274b4471d222p499},
{0x1.5b3ffffffb99fp8, 0x1.f78071e284acfp500},
{0x1.5c3ffffffb99fp8, 0x1.562a3748e0ae8p502},
{0x1.5d3ffffffb99fp8, 0x1.d10ce1fc412f2p503},
{0x1.5e3ffffffb99fp8, 0x1.3c08d26ba29edp505},
{0x1.5f3ffffffb99fp8, 0x1.ad890dbdcc46ap506},
{0x1.603ffffffb99fp8, 0x1.23e648944393ap508},
{0x1.613ffffffb99fp8, 0x1.8cbb8c9e43a63p509},
{0x1.623ffffffb99fp8, 0x1.0d9b966e13d61p511},
{0x1.633ffffffb99fp8, 0x1.6e6f586d0888dp512},
{0x1.643ffffffb99fp8, 0x1.f20966b5813aep513},
{0x1.653ffffffb99fp8, 0x1.5273779badaf2p515},
{0x1.663ffffffb99fp8, 0x1.cc00ae664a89p516},
{0x1.673ffffffb99fp8, 0x1.389aae1391554p518},
{0x1.683ffffffb99fp8, 0x1.a8df88f5b2588p519},
{0x1.693ffffffb99fp8, 0x1.20bb34172b66ap521},
{0x1.6a3ffffffb99fp8, 0x1.886d2d5f07833p522},
{0x1.6b3ffffffb99fp8, 0x1.0aae72b8de01ep524},
{0x1.6c3ffffffb99fp8, 0x1.6a7528c7487fep525},
{0x1.6d3ffffffb99fp8, 0x1.eca18af43a36cp526},
{0x1.6e3ffffffb99fp8, 0x1.4ec709b53a35fp528},
{0x1.6f3ffffffb99fp8, 0x1.c702815c30a11p529},
{0x1.703ffffffb99fp8, 0x1.353611c2fab72p531},
{0x1.713ffffffb99fp8, 0x1.a442f8858a925p532},
{0x1.723ffffffb99fp8, 0x1.1d98ed4a7bba3p534},
{0x1.733ffffffb99fp8, 0x1.842ac5348b7cep535},
{0x1.743ffffffb99fp8, 0x1.07c97097fb529p537},
{0x1.753ffffffb99fp8, 0x1.6686064a6be2ap538},
{0x1.763ffffffb99fp8, 0x1.e748b46cfe14cp539},
{0x1.773ffffffb99fp8, 0x1.4b24d0e9033c7p541},
{0x1.783ffffffb99fp8, 0x1.c21233e5293dap542},
{0x1.793ffffffb99fp8, 0x1.31dae2fdf0407p544},
{0x1.7a3ffffffb99fp8, 0x1.9fb3386e7303dp545},
{0x1.7b3ffffffb99fp8, 0x1.1a7f5bb80b183p547},
{0x1.7c3ffffffb99fp8, 0x1.7ff432dfa67a9p548},
{0x1.7d3ffffffb99fp8, 0x1.04ec79737cde7p550},
{0x1.7e3ffffffb99fp8, 0x1.62a1d2414486ep551},
{0x1.7f3ffffffb99fp8, 0x1.e1feb963592a3p552},
{0x1.803ffffffb99fp8, 0x1.478cb0da3248p554},
{0x1.813ffffffb99fp8, 0x1.bd2f9f74b3ecep555},
{0x1.823ffffffb99fp8, 0x1.2e8907921a545p557},
{0x1.833ffffffb99fp8, 0x1.9b3025158e763p558},
{0x1.843ffffffb99fp8, 0x1.176e672da841p560},
{0x1.853ffffffb99fp8, 0x1.7bc9557d90bb5p561},
{0x1.863ffffffb99fp8, 0x1.021776f23b20ap563},
{0x1.873ffffffb99fp8, 0x1.5ec86e4bf78ccp564},
{0x1.883ffffffb99fp8, 0x1.dcc3708ecfe88p565},
{0x1.893ffffffb99fp8, 0x1.43fe8d7ac0079p567},
{0x1.8a3ffffffb99fp8, 0x1.b85a9de96d206p568},
{0x1.8b3ffffffb99fp8, 0x1.2b406595ebc2fp570},
{0x1.8c3ffffffb99fp8, 0x1.96b99b42ee81ep571},
{0x1.8d3ffffffb99fp8, 0x1.1465f7bc5d4f3p573},
{0x1.8e3ffffffb99fp8, 0x1.77aa0c86e3254p574},
{0x1.8f3ffffffb99fp8, 0x1.fe94a5f24f127p575},
{0x1.903ffffffb99fp8, 0x1.5af9bc5f10484p577},
{0x1.913ffffffb99fp8, 0x1.d796b1199ca0dp578},
{0x1.923ffffffb99fp8, 0x1.407a4b0a99581p580},
{0x1.933ffffffb99fp8, 0x1.b393098be48c6p581},
{0x1.943ffffffb99fp8, 0x1.2800e367d7873p583},
{0x1.953ffffffb99fp8, 0x1.924f782080a9p584},
{0x1.963ffffffb99fp8, 0x1.1165f5b7b4e77p586},
{0x1.973ffffffb99fp8, 0x1.739637ce995dep587},
{0x1.983ffffffb99fp8, 0x1.f909ef553fe1dp588},
{0x1.993ffffffb99fp8, 0x1.57359ec295bd8p590},
{0x1.9a3ffffffb99fp8, 0x1.d278529f70c72p591},
{0x1.9b3ffffffb99fp8, 0x1.3cffce16c6a9fp593},
{0x1.9c3ffffffb99fp8, 0x1.aed8bd0d76c2ep594},
{0x1.9d3ffffffb99fp8, 0x1.24ca67ad88b68p596},
{0x1.9e3ffffffb99fp8, 0x1.8df19938fe6d4p597},
{0x1.9f3ffffffb99fp8, 0x1.0e6e49b5016fbp599},
{0x1.a03ffffffb99fp8, 0x1.6f8db78116a48p600},
{0x1.a13ffffffb99fp8, 0x1.f38e9ecb87da4p601},
{0x1.a23ffffffb99fp8, 0x1.537bf81122a93p603},
{0x1.a33ffffffb99fp8, 0x1.cd682d2c39ab4p604},
{0x1.a43ffffffb99fp8, 0x1.398efb7895c02p606},
{0x1.a53ffffffb99fp8, 0x1.aa2b938729ffap607},
{0x1.a63ffffffb99fp8, 0x1.219cd9531c9cep609},
{0x1.a73ffffffb99fp8, 0x1.899fdc76e059bp610},
{0x1.a83ffffffb99fp8, 0x1.0b7edc8aa647ep612},
{0x1.a93ffffffb99fp8, 0x1.6b906c232d65ep613},
{0x1.aa3ffffffb99fp8, 0x1.ee22898b97fbep614},
{0x1.ab3ffffffb99fp8, 0x1.4fccab37000cep616},
{0x1.ac3ffffffb99fp8, 0x1.c866193ae89dbp617},
{0x1.ad3ffffffb99fp8, 0x1.3627b854c5c27p619},
{0x1.ae3ffffffb99fp8, 0x1.a58b68788e1e6p620},
{0x1.af3ffffffb99fp8, 0x1.1e781f8a5efe5p622},
{0x1.b03ffffffb99fp8, 0x1.855a202353f77p623},
{0x1.b13ffffffb99fp8, 0x1.0897974f62fe1p625},
{0x1.b23ffffffb99fp8, 0x1.679e369129826p626},
{0x1.b33ffffffb99fp8, 0x1.e8c58542c521dp627},
{0x1.b43ffffffb99fp8, 0x1.4c279b7142392p629},
{0x1.b53ffffffb99fp8, 0x1.c371efb43e76ep630},
{0x1.b63ffffffb99fp8, 0x1.32c9ea1ab59ccp632},
{0x1.b73ffffffb99fp8, 0x1.a0f817c69fb0ap633},
{0x1.b83ffffffb99fp8, 0x1.1b5c21ca08788p635},
{0x1.b93ffffffb99fp8, 0x1.812042e534a64p636},
{0x1.ba3ffffffb99fp8, 0x1.05b86359a079cp638},
{0x1.bb3ffffffb99fp8, 0x1.63b6f7fddd3efp639},
{0x1.bc3ffffffb99fp8, 0x1.e3776813fda8ep640},
{0x1.bd3ffffffb99fp8, 0x1.488cac4ce84e7p642},
{0x1.be3ffffffb99fp8, 0x1.be8b89ed9a77dp643},
{0x1.bf3ffffffb99fp8, 0x1.2f75768394a5p645},
{0x1.c03ffffffb99fp8, 0x1.9c717dbaae2b8p646},
{0x1.c13ffffffb99fp8, 0x1.1848c7ccfefe3p648},
{0x1.c23ffffffb99fp8, 0x1.7cf223c0074fbp649},
{0x1.c33ffffffb99fp8, 0x1.02e12a3ec0173p651},
{0x1.c43ffffffb99fp8, 0x1.5fda91f1b0d98p652},
{0x1.c53ffffffb99fp8, 0x1.de38089682abp653},
{0x1.c63ffffffb99fp8, 0x1.44fbc1a5fe2ddp655},
{0x1.c73ffffffb99fp8, 0x1.b9b2c1a7cc7aap656},
{0x1.c83ffffffb99fp8, 0x1.2c2a43919580dp658},
{0x1.c93ffffffb99fp8, 0x1.97f7770145248p659},
{0x1.ca3ffffffb99fp8, 0x1.153df9919867p661},
{0x1.cb3ffffffb99fp8, 0x1.78cfa212f8edcp662},
{0x1.cc3ffffffb99fp8, 0x1.0011d5d26caedp664},
{0x1.cd3ffffffb99fp8, 0x1.5c08e649b4b94p665},
{0x1.ce3ffffffb99fp8, 0x1.d9073dd4a4c7bp666},
{0x1.cf3ffffffb99fp8, 0x1.4174bfa6c0d24p668},
{0x1.d03ffffffb99fp8, 0x1.b4e7710dea691p669},
{0x1.d13ffffffb99fp8, 0x1.28e8378f2345ap671},
{0x1.d23ffffffb99fp8, 0x1.9389e0a91894fp672},
{0x1.d33ffffffb99fp8, 0x1.123b9f58df0dap674},
{0x1.d43ffffffb99fp8, 0x1.74b89d97dfdd3p675},
{0x1.d53ffffffb99fp8, 0x1.fa94a04bdb05cp676},
{0x1.d63ffffffb99fp8, 0x1.5841d736b633cp678},
{0x1.d73ffffffb99fp8, 0x1.d3e4df4a846ddp679},
{0x1.d83ffffffb99fp8, 0x1.3df78ac6c50cep681},
{0x1.d93ffffffb99fp8, 0x1.b02972b428f19p682},
{0x1.da3ffffffb99fp8, 0x1.25af390e18cbep684},
{0x1.db3ffffffb99fp8, 0x1.8f289821f41b9p685},
{0x1.dc3ffffffb99fp8, 0x1.0f41a1a5d8764p687},
{0x1.dd3ffffffb99fp8, 0x1.70acf6623ff32p688},
{0x1.de3ffffffb99fp8, 0x1.f515070ef61acp689},
{0x1.df3ffffffb99fp8, 0x1.5485473c56dfcp691},
{0x1.e03ffffffb99fp8, 0x1.ced0c4e4d59e4p692},
{0x1.e13ffffffb99fp8, 0x1.3a8407ca209c6p694},
{0x1.e23ffffffb99fp8, 0x1.ab78a196b76fdp695},
{0x1.e33ffffffb99fp8, 0x1.227f2ee6fa305p697},
{0x1.e43ffffffb99fp8, 0x1.8ad37b3bad33ep698},
{0x1.e53ffffffb99fp8, 0x1.0c4fe93ccdf88p700},
{0x1.e63ffffffb99fp8, 0x1.6cac8cde514efp701},
{0x1.e73ffffffb99fp8, 0x1.efa4b5032b54fp702},
{0x1.e83ffffffb99fp8, 0x1.50d31930266e8p704},
{0x1.e93ffffffb99fp8, 0x1.c9cac6ffa71cbp705},
{0x1.ea3ffffffb99fp8, 0x1.371a1bc09599dp707},
{0x1.eb3ffffffb99fp8, 0x1.a6d4d9189f018p708},
{0x1.ec3ffffffb99fp8, 0x1.1f580038307ccp710},
{0x1.ed3ffffffb99fp8, 0x1.868a6825185b7p711},
{0x1.ee3ffffffb99fp8, 0x1.09665f229766bp713},
{0x1.ef3ffffffb99fp8, 0x1.68b741d009e02p714},
{0x1.f03ffffffb99fp8, 0x1.ea437fb4bc319p715},
{0x1.f13ffffffb99fp8, 0x1.4d2b3038bf046p717},
{0x1.f23ffffffb99ep8, 0x1.c4d2be652cea4p718},
{0x1.f33ffffffb99ep8, 0x1.33b9ac04c0212p720},
{0x1.f43ffffffb99ep8, 0x1.a23df502a4a3ap721},
{0x1.f53ffffffb99ep8, 0x1.1c39946547606p723},
{0x1.f63ffffffb99ep8, 0x1.824d3d6b0103dp724},
{0x1.f73ffffffb99ep8, 0x1.0684ec9be79c4p726},
{0x1.f83ffffffb99ep8, 0x1.64ccf65229834p727},
{0x1.f93ffffffb99ep8, 0x1.e4f13d25df78ap728},
{0x1.fa3ffffffb99ep8, 0x1.498d6fcce3f5ep730},
{0x1.fb3ffffffb99ep8, 0x1.bfe8844c8ea89p731},
{0x1.fc3ffffffb99ep8, 0x1.30629e3b46a18p733},
{0x1.fd3ffffffb99ep8, 0x1.9db3d1822eed1p734},
{0x1.fe3ffffffb99ep8, 0x1.1923d3162d5cep736},
{0x1.ff3ffffffb99ep8, 0x1.7e1bd9f724dbcp737},
{0x1.001ffffffdccfp9, 0x1.03ab7b2c9b517p739},
{0x1.009ffffffdccfp9, 0x1.60ed8bd54933ep740},
{0x1.011ffffffdccfp9, 0x1.dfadc3cd79f32p741},
{0x1.019ffffffdccfp9, 0x1.45f9bbb2a35d1p743},
{0x1.021ffffffdccfp9, 0x1.bb0bf258b833ap744},
{0x1.029ffffffdccfp9, 0x1.2d14d8520baf7p746},
{0x1.031ffffffdccfp9, 0x1.99364b282dd34p747},
{0x1.039ffffffdccfp9, 0x1.1616a4367556fp749},
{0x1.041ffffffdccfp9, 0x1.79f61d0f30fbp750},
{0x1.049ffffffdccfp9, 0x1.00d9f49709365p752},
{0x1.051ffffffdccfp9, 0x1.5d18e41eebfc4p753},
{0x1.059ffffffdccfp9, 0x1.da78ea95d97f9p754},
{0x1.061ffffffdccfp9, 0x1.426ff7fe794b6p756},
{0x1.069ffffffdccfp9, 0x1.b63ce2972ea1ep757},
{0x1.071ffffffdccfp9, 0x1.29d0407f62d33p759},
{0x1.079ffffffdccfp9, 0x1.94c53ee806803p760},
{0x1.081ffffffdccfp9, 0x1.1311eff49ae9ap762},
{0x1.089ffffffdccfp9, 0x1.75dbe653c2ceap763},
{0x1.091ffffffdccfp9, 0x1.fc2085b6a9375p764},
{0x1.099ffffffdccfp9, 0x1.594ee148935c8p766},
{0x1.0a1ffffffdccfp9, 0x1.d55288db74dc3p767},
{0x1.0a9ffffffdccfp9, 0x1.3ef00912762eap769},
{0x1.0b1ffffffdccfp9, 0x1.b17b2f7ee7f4ep770},
{0x1.0b9ffffffdccfp9, 0x1.2694bd41472c4p772},
{0x1.0c1ffffffdccfp9, 0x1.90608a1681a3ep773},
{0x1.0c9ffffffdccfp9, 0x1.10159ec1486a4p775},
{0x1.0d1ffffffdccfp9, 0x1.71cd15bf6b516p776},
{0x1.0d9ffffffdccfp9, 0x1.f69ca06d83551p777},
{0x1.0e1ffffffdccfp9, 0x1.558f65bed5d1ap779},
{0x1.0e9ffffffdccfp9, 0x1.d03a766bae541p780},
{0x1.0f1ffffffdccfp9, 0x1.3b79d39d672c6p782},
{0x1.0f9ffffffdccfp9, 0x1.acc6b3ef261e7p783},
{0x1.101ffffffdccfp9, 0x1.2362355c94574p785},
{0x1.109ffffffdccfp9, 0x1.8c080a68bcd97p786},
{0x1.111ffffffdccfp9, 0x1.0d21994e9f02ap788},
{0x1.119ffffffdccfp9, 0x1.6dc98ba5b51bp789},
{0x1.121ffffffdccfp9, 0x1.f1280e4617147p790},
{0x1.129ffffffdccfp9, 0x1.51da544077fa2p792},
{0x1.131ffffffdccfp9, 0x1.cb308b8399fb7p793},
{0x1.139ffffffdccfp9, 0x1.380d3c9a00e7ep795},
{0x1.141ffffffdccfp9, 0x1.a81f4b2e55334p796},
{0x1.149ffffffdccfp9, 0x1.20388fdc417d5p798},
{0x1.151ffffffdccfp9, 0x1.87bb9df31efbp799},
{0x1.159ffffffdccfp9, 0x1.0a35c88f80cbp801},
{0x1.161ffffffdccfp9, 0x1.69d128b22d25ap802},
{0x1.169ffffffdccfp9, 0x1.ebc2a4ab78bb5p803},
{0x1.171ffffffdccfp9, 0x1.4e2f8fdd883d6p805},
{0x1.179ffffffdccfp9, 0x1.c634a0cec7546p806},
{0x1.181ffffffdccfp9, 0x1.34aa294e0c99ep808},
{0x1.189ffffffdccfp9, 0x1.a384d0e8ecc3p809},
{0x1.191ffffffdccfp9, 0x1.1d17b4109e865p811},
{0x1.199ffffffdccfp9, 0x1.837b23284f5e9p812},
{0x1.1a1ffffffdccfp9, 0x1.075215b6dcdc8p814},
{0x1.1a9ffffffdccfp9, 0x1.65e3cde76e421p815},
{0x1.1b1ffffffdccfp9, 0x1.e66c397f0e285p816},
{0x1.1b9ffffffdccfp9, 0x1.4a8efbf67ceccp818},
{0x1.1c1ffffffdccfp9, 0x1.c1468f660e51bp819},
{0x1.1c9ffffffdccfp9, 0x1.31507f4997713p821},
{0x1.1d1ffffffdccfp9, 0x1.9ef72130544cep822},
{0x1.1d9ffffffdccfp9, 0x1.19ff898e9368dp824},
{0x1.1e1ffffffdccfp9, 0x1.7f4678d82ff18p825},
{0x1.1e9ffffffdccfp9, 0x1.04766a36fd582p827},
{0x1.1f1ffffffdccfp9, 0x1.62015c9e2f34p828},
{0x1.1f9ffffffdccfp9, 0x1.e124a317460fp829},
{0x1.201ffffffdccfp9, 0x1.46f87c3b54d8ep831},
{0x1.209ffffffdccfp9, 0x1.bc6630ce5faecp832},
{0x1.211ffffffdccfp9, 0x1.2e00246624382p834},
{0x1.219ffffffdccfp9, 0x1.9a761879cac82p835},
{0x1.221ffffffdccfp9, 0x1.16eff82ee1911p837},
{0x1.229ffffffdccfp9, 0x1.7b1d7e2eda2c6p838},
{0x1.231ffffffdccfp9, 0x1.01a2afc0d75c2p840},
{0x1.239ffffffdccfp9, 0x1.5e29b684536ep841},
{0x1.241ffffffdccfp9, 0x1.dbebb83e52c5dp842},
{0x1.249ffffffdccfp9, 0x1.436bf4aaba53p844},
{0x1.251ffffffdccfp9, 0x1.b7935ef798935p845},
{0x1.259ffffffdccfp9, 0x1.2ab8fec5df362p847},
{0x1.261ffffffdccfp9, 0x1.9601939d5137dp848},
{0x1.269ffffffdccfp9, 0x1.13e8e80d6759dp850},
{0x1.271ffffffdccfp9, 0x1.770012b39ed67p851},
{0x1.279ffffffdccfp9, 0x1.fdada086b9c52p852},
{0x1.281ffffffdccfp9, 0x1.5a5cbd9bfe665p854},
{0x1.289ffffffdccfp9, 0x1.d6c15030e89c1p855},
{0x1.291ffffffdccfp9, 0x1.3fe9499128953p857},
{0x1.299ffffffdccfp9, 0x1.b2cdf43b59797p858},
{0x1.2a1ffffffdccfp9, 0x1.277af4d2d449ap860},
{0x1.2a9ffffffdccfp9, 0x1.91996fd498417p861},
{0x1.2b1ffffffdccfp9, 0x1.10ea41886590dp863},
{0x1.2b9ffffffdccfp9, 0x1.72ee16480890ep864},
{0x1.2c1ffffffdccfp9, 0x1.f8256bd5a1072p865},
{0x1.2c9ffffffdccfp9, 0x1.569a543aa97d8p867},
{0x1.2d1ffffffdccfp9, 0x1.d1a5429cffadp868},
{0x1.2d9ffffffdccfp9, 0x1.3c705f8813894p870},
{0x1.2e1ffffffdccfp9, 0x1.ae15cb5be04dap871},
{0x1.2e9ffffffdccfp9, 0x1.2445ed3e27324p873},
{0x1.2f1ffffffdccfp9, 0x1.8d3d8ab9f0bdep874},
{0x1.2f9ffffffdccfp9, 0x1.0df3ed3fc701dp876},
{0x1.301ffffffdccfp9, 0x1.6ee76926e122bp877},
{0x1.309ffffffdccfp9, 0x1.f2ac9640362cap878},
{0x1.311ffffffdccfp9, 0x1.52e25d083c6f6p880},
{0x1.319ffffffdccfp9, 0x1.cc9767a099276p881},
{0x1.321ffffffdccfp9, 0x1.39011b7511e91p883},
{0x1.329ffffffdccfp9, 0x1.a96abf82e5bedp884},
{0x1.331ffffffdccfp9, 0x1.2119ceff4e062p886},
{0x1.339ffffffdccfp9, 0x1.88edc2473f3cfp887},
{0x1.341ffffffdccfp9, 0x1.0b05d4146a019p889},
{0x1.349ffffffdccfp9, 0x1.6aebebe3397ccp890},
{0x1.351ffffffdccfp9, 0x1.ed42f5104656ep891},
{0x1.359ffffffdccfp9, 0x1.4f34bafe2847bp893},
{0x1.361ffffffdccfp9, 0x1.c79797c887ff8p894},
{0x1.369ffffffdccfp9, 0x1.359b628909b0ap896},
{0x1.371ffffffdccfp9, 0x1.a4ccac407db6ep897},
{0x1.379ffffffdccfp9, 0x1.1df681534dcc2p899},
{0x1.381ffffffdccfp9, 0x1.84a9f4d4f272ap900},
{0x1.389ffffffdccfp9, 0x1.081fdf276bf44p902},
{0x1.391ffffffdccfp9, 0x1.66fb7f67746f6p903},
{0x1.399ffffffdccfp9, 0x1.e7e85e064cb73p904},
{0x1.3a1ffffffdccfp9, 0x1.4b91516684d28p906},
{0x1.3a9ffffffdccfp9, 0x1.c2a5ac0f3d022p907},
{0x1.3b1ffffffdccfp9, 0x1.323f1a3f5edc4p909},
{0x1.3b9ffffffdccfp9, 0x1.a03b6d89faf11p910},
{0x1.3c1ffffffdccfp9, 0x1.1adbebbbf9351p912},
{0x1.3c9ffffffdccfp9, 0x1.80720118fc863p913},
{0x1.3d1ffffffdccfp9, 0x1.0541f7d976c95p915},
{0x1.3d9ffffffdccfp9, 0x1.631604f454091p916},
{0x1.3e1ffffffdccfp9, 0x1.e29ca75828ca4p917},
{0x1.3e9ffffffdccfp9, 0x1.47f803db3082ep919},
{0x1.3f1ffffffdccfp9, 0x1.bdc17ddb963f2p920},
{0x1.3f9ffffffdccfp9, 0x1.2eec285d246c2p922},
{0x1.401ffffffdccfp9, 0x1.9bb6dfb8d5a7bp923},
{0x1.409ffffffdccfp9, 0x1.17c9f5ff316ddp925},
{0x1.411ffffffdccfp9, 0x1.7c45c625cf3bcp926},
{0x1.419ffffffdccfp9, 0x1.026c07ca1067p928},
{0x1.421ffffffdccfp9, 0x1.5f3b5e200997dp929},
{0x1.429ffffffdccfp9, 0x1.dd5fa7afd8289p930},
{0x1.431ffffffdccfp9, 0x1.4468b644f2c7fp932},
{0x1.439ffffffdccfp9, 0x1.b8eae6ffb1c26p933},
{0x1.441ffffffdccfp9, 0x1.2ba272f04fa72p935},
{0x1.449ffffffdccfp9, 0x1.973edf89954efp936},
{0x1.451ffffffdccfp9, 0x1.14c088262904bp938},
{0x1.459ffffffdccfp9, 0x1.782523695aef2p939},
{0x1.461ffffffdccfp9, 0x1.ff3bf1add8023p940},
{0x1.469ffffffdccfp9, 0x1.5b6b6cd54844dp942},
{0x1.471ffffffdccfp9, 0x1.d831362a33e02p943},
{0x1.479ffffffdccfp9, 0x1.40e34cdaa0c9dp945},
{0x1.481ffffffdccfp9, 0x1.b421c1b7c391cp946},
{0x1.489ffffffdccfp9, 0x1.2861e04eed965p948},
{0x1.491ffffffdccfp9, 0x1.92d34a1abd55p949},
{0x1.499ffffffdccfp9, 0x1.11bf8a7ca8dc9p951},
{0x1.4a1ffffffdccfp9, 0x1.740ff8ac10594p952},
{0x1.4a9ffffffdccfp9, 0x1.f9af6a367aa8cp953},
{0x1.4b1ffffffdccfp9, 0x1.57a613525a444p955},
{0x1.4b9ffffffdccfp9, 0x1.d3112a55b14f7p956},
{0x1.4c1ffffffdccfp9, 0x1.3d67ac204487bp958},
{0x1.4c9ffffffdccfp9, 0x1.af65e8a8eee76p959},
{0x1.4d1ffffffdccfp9, 0x1.252a57165ab35p961},
{0x1.4d9ffffffdccfp9, 0x1.8e73fcebbcdf2p962},
{0x1.4e1ffffffdccfp9, 0x1.0ec6e5905727p964},
{0x1.4e9ffffffdccfp9, 0x1.7006260fe518p965},
{0x1.4f1ffffffdccfp9, 0x1.f4324dde1b853p966},
{0x1.4f9ffffffdccfp9, 0x1.53eb342838912p968},
{0x1.501ffffffdccfp9, 0x1.cdff5c312677p969},
{0x1.509ffffffdccfp9, 0x1.39f5b8e646512p971},
{0x1.511ffffffdccfp9, 0x1.aab736e0229e8p972},
{0x1.519ffffffdccfp9, 0x1.21fbbe2a7cc33p974},
{0x1.521ffffffdccfp9, 0x1.8a20d5dbe17b1p975},
{0x1.529ffffffdccfp9, 0x1.0bd6823000616p977},
{0x1.531ffffffdccfp9, 0x1.6c078c0f5af0cp978},
{0x1.539ffffffdccfp9, 0x1.eec471cd26923p979},
{0x1.541ffffffdccfp9, 0x1.503ab239a52eep981},
{0x1.549ffffffdccfp9, 0x1.c8fba42a91b8p982},
{0x1.551ffffffdccfp9, 0x1.368d584898928p984},
{0x1.559ffffffdccfp9, 0x1.a61587d0f8cb4p985},
{0x1.561ffffffdccfp9, 0x1.1ed5fcb4fed8p987},
{0x1.569ffffffdccfp9, 0x1.85d9b3294cbccp988},
{0x1.571ffffffdccfp9, 0x1.08ee496ae24e1p990},
{0x1.579ffffffdccfp9, 0x1.68140b7c89c5cp991},
{0x1.581ffffffdccfp9, 0x1.e965aba3129a2p992},
{0x1.589ffffffdccfp9, 0x1.4c9470ba47e91p994},
{0x1.591ffffffdccfp9, 0x1.c405db1de4f69p995},
{0x1.599ffffffdccfp9, 0x1.332e6fade5fp997},
{0x1.5a1ffffffdccfp9, 0x1.a180b7549973p998},
{0x1.5a9ffffffdccfp9, 0x1.1bb8fa248f731p1000},
{0x1.5b1ffffffdccfp9, 0x1.819e736fecc0ap1001},
{0x1.5b9ffffffdccfp9, 0x1.060e248ff8e45p1003},
{0x1.5c1ffffffdccfp9, 0x1.642b85802c37dp1004},
{0x1.5c9ffffffdccfp9, 0x1.e415d17516714p1005},
{0x1.5d1ffffffdccfp9, 0x1.48f8532dcd8aap1007},
{0x1.5d9ffffffdccfp9, 0x1.bf1dda53d4168p1008},
{0x1.5e1ffffffdccfp9, 0x1.2fd8e4c6c1a74p1010},
{0x1.5e9ffffffdccfp9, 0x1.9cf8a1a8a05e1p1011},
{0x1.5f1ffffffdccfp9, 0x1.18a49e2c20c14p1013},
{0x1.5f9ffffffdccfp9, 0x1.7d6ef5a877896p1014},
{0x1.601ffffffdccfp9, 0x1.0335fd2d4d32ap1016},
{0x1.609ffffffdccfp9, 0x1.604ddb98aeeb6p1017},
{0x1.611ffffffdccfp9, 0x1.ded4b9cce1c65p1018},
{0x1.619ffffffdccep9, 0x1.45663d67095d1p1020},
{0x1.621ffffffdccep9, 0x1.ba437b80a6915p1021},
{0x1.629ffffffdccep9, 0x1.2c8c9d8cda0c8p1023},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{ 0x1.63be411e096ep-2, 0x1.a95c1f32ed8d5p-2},
{-0x1.62d7c116d2e32p-1, -0x1.fff3910089df7p-2},
{ 0x1.633f993a730c9p-2, 0x1.a8a8e5d1e41ccp-2},
{ 0x1.a0e95d59498e9p-2, 0x1.01499d91804bdp-1},
{ 0x1.632cfb1033275p-2, 0x1.a88e8f5550a34p-2},
};
for (double[] testCase: testCases)
failures+=testExpm1Case(testCase[0], testCase[1]);
return failures;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,744 @@
/*
* Copyright (c) 2003, 2026, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import jdk.test.lib.RandomFactory;
import java.util.function.DoubleUnaryOperator;
/*
* @test
* @bug 4851625 8301444 8331354
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build HyperbolicTests
* @run main HyperbolicTests
* @summary Tests for StrictMath.{sinh, cosh, tanh, asinh, acosh, atanh}
*/
/**
* The tests in ../Math/HyperbolicTests.java test properties that
* should hold for any implementation of the hyperbolic functions
* sinh, cosh, and tanh, including the FDLIBM-based ones required by
* the StrictMath class. Therefore, the test cases in
* ../Math/HyperbolicTests.java are run against both the Math and
* StrictMath versions of the hyperbolic methods. The role of this
* test is to verify that the FDLIBM algorithms are being used by
* running golden file tests on values that may vary from one
* conforming implementation of the hyperbolics to another.
*/
public class HyperbolicTests {
private HyperbolicTests(){}
public static void main(String... args) {
int failures = 0;
failures += testAgainstTranslitCommon();
failures += testAgainstTranslitSinh();
failures += testAgainstTranslitCosh();
failures += testAgainstTranslitTanh();
failures += testAgainstTranslitAtanh();
failures += testSinh();
failures += testCosh();
failures += testTanh();
failures += testAsinh();
failures += testAcosh();
failures += testAtanh();
if (failures > 0) {
System.err.println("Testing the hyperbolics incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
/**
* Bundle together groups of testing methods.
*/
private static enum HyperbolicTest {
SINH(HyperbolicTests::testSinhCase, FdlibmTranslit::sinh),
COSH(HyperbolicTests::testCoshCase, FdlibmTranslit::cosh),
TANH(HyperbolicTests::testTanhCase, FdlibmTranslit::tanh),
ASINH(HyperbolicTests::testAsinhCase, FdlibmTranslit::asinh),
ACOSH(HyperbolicTests::testAcoshCase, FdlibmTranslit::acosh),
ATANH(HyperbolicTests::testAtanhCase, FdlibmTranslit::atanh);
private DoubleDoubleToInt testCase;
private DoubleUnaryOperator transliteration;
HyperbolicTest(DoubleDoubleToInt testCase, DoubleUnaryOperator transliteration) {
this.testCase = testCase;
this.transliteration = transliteration;
}
public DoubleDoubleToInt testCase() {return testCase;}
public DoubleUnaryOperator transliteration() {return transliteration;}
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test against shared points of interest.
*/
private static int testAgainstTranslitCommon() {
int failures = 0;
double[] pointsOfInterest = {
Double.MIN_NORMAL,
1.0,
Tests.createRandomDouble(random),
};
for (var testMethods : HyperbolicTest.values()) {
for (double testPoint : pointsOfInterest) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, testMethods);
}
}
return failures;
}
/**
* Test StrictMath.sinh against transliteration port of sinh.
*/
private static int testAgainstTranslitSinh() {
int failures = 0;
double x;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0.0,
22.0,
-22.0,
0x1.0p-28,
-0x1.0p-28,
// StrictMath.log(Double.MAX_VALUE) ~= 709.782712893384
0x1.62e42fefa39efp9,
-0x1.62e42fefa39efp9,
// Largest argument with finite sinh, 710.4758600739439
0x1.633ce8fb9f87dp9,
-0x1.633ce8fb9f87dp9,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, HyperbolicTest.SINH);
}
return failures;
}
/**
* Test StrictMath.cosh against transliteration port of cosh.
*/
private static int testAgainstTranslitCosh() {
int failures = 0;
double x;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0.0,
22.0,
-22.0,
// StrictMath.log(2)/2 ~= 0.34657359027997264
0x1.62e42fefa39efp-2,
-0x1.62e42fefa39efp-2,
0x1.0p-28,
-0x1.0p-28,
// StrictMath.log(Double.MAX_VALUE) ~= 709.782712893384
0x1.62e42fefa39efp9,
-0x1.62e42fefa39efp9,
// Largest argument with finite cosh, 710.4758600739439
0x1.633ce8fb9f87dp9,
-0x1.633ce8fb9f87dp9,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, HyperbolicTest.COSH);
}
return failures;
}
/**
* Test StrictMath.tanh against transliteration port of tanh
*/
private static int testAgainstTranslitTanh() {
int failures = 0;
double x;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0.0,
0x1.0p-55,
-0x1.0p-55,
1.0,
-1.0,
22.0,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, HyperbolicTest.COSH);
}
return failures;
}
/**
* Test StrictMath.tanh against transliteration port of tanh
*/
private static int testAgainstTranslitAtanh() {
int failures = 0;
double x;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0.0,
0x1.0p-28,
-0x1.0p-28,
1.0,
-1.0,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, HyperbolicTest.ATANH);
}
return failures;
}
private interface DoubleDoubleToInt {
int apply(double x, double y);
}
private static int testRange(double start, double increment, int count,
HyperbolicTest testMethods) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures +=
testMethods.testCase().apply(x, testMethods.transliteration().applyAsDouble(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count,
HyperbolicTest testMethods) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures +=
testMethods.testCase().apply(x, testMethods.transliteration().applyAsDouble(x));
}
return failures;
}
private static int testSinhCase(double input, double expected) {
return Tests.test("StrictMath.sinh(double)", input,
StrictMath::sinh, expected);
}
private static int testCoshCase(double input, double expected) {
return Tests.test("StrictMath.cosh(double)", input,
StrictMath::cosh, expected);
}
private static int testTanhCase(double input, double expected) {
return Tests.test("StrictMath.tanh(double)", input,
StrictMath::tanh, expected);
}
private static int testAsinhCase(double input, double expected) {
return Tests.test("StrictMath.asinh(double)", input,
StrictMath::asinh, expected);
}
private static int testAcoshCase(double input, double expected) {
return Tests.test("StrictMath.asinh(double)", input,
StrictMath::acosh, expected);
}
private static int testAtanhCase(double input, double expected) {
return Tests.test("StrictMath.atanh(double)", input,
StrictMath::atanh, expected);
}
private static int testSinh() {
int failures = 0;
double [][] testCases = {
{0x1.5798ee2308c3ap-27, 0x1.5798ee2308c3bp-27},
{0x1.ffffffffffff8p-26, 0x1.ffffffffffffap-26},
{0x1.ffffffffffffep-26, 0x1.0p-25},
{0x1.ffffffffffff8p-25, 0x1.ffffffffffffep-25},
{0x1.ffffffffffffap-25, 0x1.0p-24},
{0x1.ad7f29abcaf47p-24, 0x1.ad7f29abcaf53p-24},
{0x1.ad7f29abcaf48p-24, 0x1.ad7f29abcaf54p-24},
{0x1.fffffffffffeap-24, 0x1.0p-23},
{0x1.ffffffffffff8p-24, 0x1.0000000000007p-23},
{0x1.fffffffffffaap-23, 0x1.0p-22},
{0x1.ffffffffffff8p-23, 0x1.0000000000027p-22},
{0x1.ffffffffffeaap-22, 0x1.0p-21},
{0x1.ffffffffffff8p-22, 0x1.00000000000a7p-21},
{0x1.ffffffffffaaap-21, 0x1.0p-20},
{0x1.ffffffffffff8p-21, 0x1.00000000002a7p-20},
{0x1.0c6f7a0b5ed8cp-20, 0x1.0c6f7a0b5f09fp-20},
{0x1.0c6f7a0b5ed8dp-20, 0x1.0c6f7a0b5f0ap-20},
{0x1.fffffffffeaaap-20, 0x1.0p-19},
{0x1.ffffffffffff8p-20, 0x1.0000000000aa7p-19},
{0x1.ffffffffffff8p-19, 0x1.0000000002aa7p-18},
{0x1.ffffffffffff7p-18, 0x1.000000000aaa6p-17},
{0x1.4f8b588e368d9p-17, 0x1.4f8b588e4e928p-17},
{0x1.ffffffffffffep-17, 0x1.000000002aaa9p-16},
{0x1.0p-16, 0x1.000000002aaaap-16},
{0x1.fffffffffffffp-16, 0x1.00000000aaaabp-15},
{0x1.fffffffffeaaap-15, 0x1.00000002aap-14},
{0x1.ffffffffffffep-15, 0x1.00000002aaaa9p-14},
{0x1.0p-14, 0x1.00000002aaaaap-14},
{0x1.a36e2eb1c3dd4p-14, 0x1.a36e2ebd7e43ap-14},
{0x1.a36e2eb1c3f8cp-14, 0x1.a36e2ebd7e5f1p-14},
{0x1.a36e2eb1c432cp-14, 0x1.a36e2ebd7e991p-14},
{0x1.fffffffffffffp-14, 0x1.0000000aaaaabp-13},
{0x1.ffffffffffffep-13, 0x1.0000002aaaaa9p-12},
{0x1.0p-12, 0x1.0000002aaaaaap-12},
{0x1.ffffffffff7f9p-12, 0x1.000000aaaa6a9p-11},
{0x1.fffffffffffffp-12, 0x1.000000aaaaaadp-11},
{0x1.ffffffffffffep-11, 0x1.000002aaaaacbp-10},
{0x1.0p-10, 0x1.000002aaaaaccp-10},
{0x1.0624dd2f1a79p-10, 0x1.0624e00c1c776p-10},
{0x1.0624dd2f1a8c9p-10, 0x1.0624e00c1c8bp-10},
{0x1.0624dd2f1a9fcp-10, 0x1.0624e00c1c9e3p-10},
{0x1.ffffffffffffep-10, 0x1.00000aaaaaccbp-9},
{0x1.0p-9, 0x1.00000aaaaacccp-9},
{0x1.ffffffffffe4ap-9, 0x1.00002aaaacbf2p-8},
{0x1.fffffffffffffp-9, 0x1.00002aaaacccdp-8},
{0x1.fffffffffff9dp-8, 0x1.0000aaaaccc9bp-7},
{0x1.ffffffffffffep-8, 0x1.0000aaaacccccp-7},
{0x1.0p-7, 0x1.0000aaaaccccdp-7},
{0x1.47ae147ae146fp-7, 0x1.47af7a654e9e2p-7},
{0x1.47ae147ae147ap-7, 0x1.47af7a654e9eep-7},
{0x1.47ae147ae147bp-7, 0x1.47af7a654e9efp-7},
{0x1.fffffffffffb6p-7, 0x1.0002aaaccccb4p-6},
{0x1.fffffffffffcap-7, 0x1.0002aaaccccbep-6},
{0x1.ffffffffffff7p-7, 0x1.0002aaaccccd5p-6},
{0x1.fffffffffffe9p-6, 0x1.000aaacccd001p-5},
{0x1.ffffffffffff7p-6, 0x1.000aaacccd008p-5},
{0x1.fffffffffffffp-6, 0x1.000aaacccd00dp-5},
{0x1.ffffffffffff6p-5, 0x1.002aacccd9cd7p-4},
{0x1.ffffffffffff8p-5, 0x1.002aacccd9cd9p-4},
{0x1.0p-4, 0x1.002aacccd9cddp-4},
{0x1.9999999999995p-4, 0x1.9a487337b59afp-4},
{0x1.9999999999996p-4, 0x1.9a487337b59afp-4},
{0x1.9999999999998p-4, 0x1.9a487337b59b1p-4},
{0x1.ffffffffffffap-4, 0x1.00aaccd00d2edp-3},
{0x1.ffffffffffffcp-4, 0x1.00aaccd00d2efp-3},
{0x1.ffffffffffff3p-3, 0x1.02accd9d080fbp-2},
{0x1.ffffffffffffdp-3, 0x1.02accd9d08101p-2},
{0x1.fffffffffffffp-3, 0x1.02accd9d08101p-2},
{0x1.fffffffffffecp-2, 0x1.0acd00fe63b8cp-1},
{0x1.ffffffffffffcp-2, 0x1.0acd00fe63b94p-1},
{0x1.0p-1, 0x1.0acd00fe63b97p-1},
{0x1.ffffffffffff6p-1, 0x1.2cd9fc44eb97ap0},
{0x1.ffffffffffffep-1, 0x1.2cd9fc44eb981p0},
{0x1.fffffffffffffp0, 0x1.d03cf63b6e19ep1},
{0x1.0p1, 0x1.d03cf63b6e1ap1},
{0x1.fffffffffffffp1, 0x1.b4a380370362dp4},
{0x1.0p2, 0x1.b4a380370363p4},
{0x1.ffffffffffffcp2, 0x1.749ea514eca4ep10},
{0x1.0p3, 0x1.749ea514eca66p10},
{0x1.fffffffffffffp3, 0x1.0f2ebd0a7ffdcp22},
{0x1.0p4, 0x1.0f2ebd0a7ffe4p22},
{0x1.fffffffffff68p4, 0x1.1f43fcc4b5b83p45},
{0x1.fffffffffffd4p4, 0x1.1f43fcc4b6316p45},
{0x1.0p5, 0x1.1f43fcc4b662cp45},
// Julia worst-case input
{-0x1.633c654fee2bap9, -0x1.fdf25fc26e7cp1023},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{-0x1.633c654fee2bap+9, -0x1.fdf25fc26e7cp1023},
{-0x1.633cae1335f26p+9, -0x1.ff149489e50a1p1023},
{ 0x1.9fcba01feb507p-2, 0x1.ab50d8e4d8c56p-2},
};
for (double[] testCase: testCases)
failures += testSinhCase(testCase[0], testCase[1]);
return failures;
}
private static int testCosh() {
int failures = 0;
double [][] testCases = {
{0x1.fffffffffb49fp-8, 0x1.00020000aaaabp0},
{0x1.47ae147ae0e45p-7, 0x1.000346de27853p0},
{0x1.fffffffffd9f3p-7, 0x1.0008000aaab05p0},
{0x1.ffffffffff9f1p-7, 0x1.0008000aaab05p0},
{0x1.fffffffffe27dp-6, 0x1.002000aaac169p0},
{0x1.ffffffffff27bp-6, 0x1.002000aaac16bp0},
{0x1.ffffffffffb9cp-5, 0x1.00800aab05b1ep0},
{0x1.ffffffffffd9dp-5, 0x1.00800aab05b1fp0},
{0x1.9999999999368p-4, 0x1.0147f40224b2ep0},
{0x1.9999999999727p-4, 0x1.0147f40224b35p0},
{0x1.ffffffffffed1p-4, 0x1.0200aac16db6cp0},
{0x1.fffffffffffd1p-4, 0x1.0200aac16db6ep0},
{0x1.ffffffffffeb4p-3, 0x1.080ab05ca613bp0},
{0x1.ffffffffffff2p-3, 0x1.080ab05ca6146p0},
{0x1.ffffffffffff3p-2, 0x1.20ac1862ae8cep0},
{0x1.ffffffffffff9p-2, 0x1.20ac1862ae8dp0},
{0x1.0p0, 0x1.8b07551d9f551p0},
{0x1.ffffffffffffbp0, 0x1.e18fa0df2d9b3p1},
{0x1.ffffffffffffep0, 0x1.e18fa0df2d9b8p1},
{0x1.fffffffffffffp0, 0x1.e18fa0df2d9bap1},
{0x1.ffffffffffff9p1, 0x1.b4ee858de3e68p4},
{0x1.ffffffffffffep1, 0x1.b4ee858de3e7ap4},
{0x1.fffffffffffffp1, 0x1.b4ee858de3e7dp4},
{0x1.ffffffffffffcp2, 0x1.749eaa93f4e5ep10},
{0x1.ffffffffffffdp2, 0x1.749eaa93f4e64p10},
{0x1.0p3, 0x1.749eaa93f4e76p10},
{0x1.fffffffffff6fp3, 0x1.0f2ebd0a7fb9p22},
{0x1.0p4, 0x1.0f2ebd0a8005cp22},
{0x1.fffffffffffd4p4, 0x1.1f43fcc4b6316p45},
{0x1.0p5, 0x1.1f43fcc4b662cp45},
// Julia worst-case input
{-0x1.633c654fee2bap9, 0x1.fdf25fc26e7cp1023},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{-0x1.633c654fee2bap+9, 0x1.fdf25fc26e7cp1023},
{ 0x1.ff76fb3f476d5p+0, 0x1.e0976c8f0ebdfp1},
{ 0x1.633cc2ae1c934p+9, 0x1.ff66e0de4dc6fp1023},
{-0x1.1ff088806d82ep+3, 0x1.f97ccb0aef314p11},
{-0x1.628af341989dap+9, 0x1.fdf28623ef923p1021},
};
for (double[] testCase: testCases)
failures += testCoshCase(testCase[0], testCase[1]);
return failures;
}
private static int testTanh() {
int failures = 0;
double [][] testCases = {
{0x1.5798ee2308c36p-27, 0x1.5798ee2308c36p-27},
{0x1.ffffffffffffep-26, 0x1.ffffffffffffbp-26},
{0x1.ffffffffffffep-25, 0x1.ffffffffffff3p-25},
{0x1.ad7f29abcaf47p-24, 0x1.ad7f29abcaf2dp-24},
{0x1.ad7f29abcaf48p-24, 0x1.ad7f29abcaf2ep-24},
{0x1.ffffffffffffep-24, 0x1.fffffffffffd3p-24},
{0x1.ffffffffffffep-23, 0x1.fffffffffff53p-23},
{0x1.ffffffffffffep-22, 0x1.ffffffffffd53p-22},
{0x1.ffffffffffffep-21, 0x1.ffffffffff553p-21},
{0x1.0c6f7a0b5ed8dp-20, 0x1.0c6f7a0b5e767p-20},
{0x1.ffffffffffffep-20, 0x1.fffffffffd553p-20},
{0x1.ffffffffffffep-19, 0x1.fffffffff5553p-19},
{0x1.fffffffffffffp-18, 0x1.ffffffffd5555p-18},
{0x1.0p-17, 0x1.ffffffffd5556p-18},
{0x1.4f8b588e368edp-17, 0x1.4f8b588e0685p-17},
{0x1.fffffffffffffp-17, 0x1.ffffffff55554p-17},
{0x1.fffffffffffffp-16, 0x1.fffffffd55555p-16},
{0x1.0p-15, 0x1.fffffffd55556p-16},
{0x1.fffffffffe5ddp-15, 0x1.fffffff553b33p-15},
{0x1.fffffffffffffp-15, 0x1.fffffff555554p-15},
{0x1.a36e2eb1c432dp-14, 0x1.a36e2e9a4f663p-14},
{0x1.ffffffffffffep-14, 0x1.ffffffd555553p-14},
{0x1.0p-13, 0x1.ffffffd555555p-14},
{0x1.ffffffffffd51p-13, 0x1.ffffff55552aap-13},
{0x1.fffffffffffffp-13, 0x1.ffffff5555559p-13},
{0x1.ffffffffffffep-12, 0x1.fffffd5555597p-12},
{0x1.0p-11, 0x1.fffffd5555599p-12},
{0x1.fffffffffff1p-11, 0x1.fffff555558a9p-11},
{0x1.0p-10, 0x1.fffff5555599ap-11},
{0x1.0624dd2f1a9c6p-10, 0x1.0624d77516cabp-10},
{0x1.0624dd2f1a9f8p-10, 0x1.0624d77516cdep-10},
{0x1.fffffffffffddp-10, 0x1.ffffd55559976p-10},
{0x1.fffffffffffffp-10, 0x1.ffffd55559999p-10},
{0x1.ffffffffffffcp-9, 0x1.ffff555599993p-9},
{0x1.ffffffffffffep-9, 0x1.ffff555599996p-9},
{0x1.ffffffffffff8p-8, 0x1.fffd555999924p-8},
{0x1.ffffffffffffep-8, 0x1.fffd555999929p-8},
{0x1.47ae147ae1458p-7, 0x1.47ab48ae4593cp-7},
{0x1.47ae147ae1464p-7, 0x1.47ab48ae45947p-7},
{0x1.ffffffffffffep-7, 0x1.fff5559997df6p-7},
{0x1.fffffffffffffp-7, 0x1.fff5559997df8p-7},
{0x1.ffffffffffff9p-6, 0x1.ffd559992b1d8p-6},
{0x1.ffffffffffffep-6, 0x1.ffd559992b1dcp-6},
{0x1.ffffffffffff9p-5, 0x1.ff55997e030d1p-5},
{0x1.fffffffffffffp-5, 0x1.ff55997e030d6p-5},
{0x1.9999999999996p-4, 0x1.983d7795f4137p-4},
{0x1.9999999999997p-4, 0x1.983d7795f4137p-4},
{0x1.fffffffffffffp-4, 0x1.fd5992bc4b834p-4},
{0x1.0p-3, 0x1.fd5992bc4b834p-4},
{0x1.fffffffffffffp-3, 0x1.f597ea69a1c86p-3},
{0x1.ffffffffffffcp-2, 0x1.d9353d7568aefp-2},
{0x1.ffffffffffffep-2, 0x1.d9353d7568af3p-2},
{0x1.ffffffffffffbp-1, 0x1.85efab514f393p-1},
{0x1.ffffffffffffep-1, 0x1.85efab514f393p-1},
{0x1.fffffffffffd3p0, 0x1.ed9505e1bc3cep-1},
{0x1.fffffffffffe1p0, 0x1.ed9505e1bc3cfp-1},
{0x1.ffffffffffed8p1, 0x1.ffa81708a0b4p-1},
{0x1.fffffffffff92p1, 0x1.ffa81708a0b41p-1},
// Julia worst-case input
{0x1.0108b83c4bbc8p-1, 0x1.dad53a45da5b0p-2},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{-0x1.c41e527b70f43p-3, -0x1.bcea047cc736cp-3},
};
for (double[] testCase: testCases)
failures += testTanhCase(testCase[0], testCase[1]);
return failures;
}
private static int testAsinh() {
int failures = 0;
double [][] testCases = {
{0x1.5798ee2308c36p-27, 0x1.5798ee2308c35p-27},
{0x1.ffffffffffffep-26, 0x1.ffffffffffffdp-26},
{0x1.ffffffffffffep-25, 0x1.ffffffffffff9p-25},
{0x1.ad7f29abcaf47p-24, 0x1.ad7f29abcaf3bp-24},
{0x1.ad7f29abcaf48p-24, 0x1.ad7f29abcaf3cp-24},
{0x1.ffffffffffffep-24, 0x1.fffffffffffe9p-24},
{0x1.ffffffffffffep-23, 0x1.fffffffffffa9p-23},
{0x1.ffffffffffffep-22, 0x1.ffffffffffea9p-22},
{0x1.ffffffffffffep-21, 0x1.ffffffffffaa9p-21},
{0x1.0c6f7a0b5ed8dp-20, 0x1.0c6f7a0b5ea7ap-20},
{0x1.ffffffffffffep-20, 0x1.fffffffffeaa9p-20},
{0x1.ffffffffffffep-19, 0x1.fffffffffaaa9p-19},
{0x1.fffffffffffffp-18, 0x1.ffffffffeaaa9p-18},
{0x1p-17, 0x1.ffffffffeaaabp-18},
{0x1.4f8b588e368edp-17, 0x1.4f8b588e1e89ep-17},
{0x1.fffffffffffffp-17, 0x1.ffffffffaaaa9p-17},
{0x1.fffffffffffffp-16, 0x1.fffffffeaaaa9p-16},
{0x1p-15, 0x1.fffffffeaaaabp-16},
{0x1.fffffffffe5ddp-15, 0x1.fffffffaa9087p-15},
{0x1.fffffffffffffp-15, 0x1.fffffffaaaaa9p-15},
{0x1.a36e2eb1c432dp-14, 0x1.a36e2ea609cc8p-14},
{0x1.ffffffffffffep-14, 0x1.ffffffeaaaaa9p-14},
{0x1p-13, 0x1.ffffffeaaaaabp-14},
{0x1.ffffffffffd51p-13, 0x1.ffffffaaaa7fdp-13},
{0x1.fffffffffffffp-13, 0x1.ffffffaaaaaadp-13},
{0x1.ffffffffffffep-12, 0x1.fffffeaaaaacfp-12},
{0x1p-11, 0x1.fffffeaaaaad1p-12},
{0x1.fffffffffff1p-11, 0x1.fffffaaaaac21p-11},
{0x1p-10, 0x1.fffffaaaaad11p-11},
{0x1.0624dd2f1a9c6p-10, 0x1.0624da5218b5fp-10},
{0x1.0624dd2f1a9f8p-10, 0x1.0624da5218b91p-10},
{0x1.fffffffffffddp-10, 0x1.ffffeaaaad0edp-10},
{0x1.fffffffffffffp-10, 0x1.ffffeaaaad10fp-10},
{0x1.ffffffffffffcp-9, 0x1.ffffaaaad110cp-9},
{0x1.ffffffffffffep-9, 0x1.ffffaaaad110ep-9},
{0x1.ffffffffffff8p-8, 0x1.fffeaaad110aep-8},
{0x1.ffffffffffffep-8, 0x1.fffeaaad110b4p-8},
{0x1.47ae147ae1458p-7, 0x1.47acae9508ae4p-7},
{0x1.47ae147ae1464p-7, 0x1.47acae9508afp-7},
{0x1.ffffffffffffep-7, 0x1.fffaaad10fa35p-7},
{0x1.fffffffffffffp-7, 0x1.fffaaad10fa35p-7},
{0x1.ffffffffffff9p-6, 0x1.ffeaad10b5b28p-6},
{0x1.ffffffffffffep-6, 0x1.ffeaad10b5b2bp-6},
{0x1.ffffffffffff9p-5, 0x1.ffaad0fa4525bp-5},
{0x1.fffffffffffffp-5, 0x1.ffaad0fa45261p-5},
{0x1.9999999999996p-4, 0x1.98eb9e7e5fc3ap-4},
{0x1.9999999999997p-4, 0x1.98eb9e7e5fc3bp-4},
{0x1.fffffffffffffp-4, 0x1.fead0b6996972p-4},
{0x1p-3, 0x1.fead0b6996972p-4},
{0x1.fffffffffffffp-3, 0x1.facfb2399e636p-3},
{0x1.ffffffffffffcp-2, 0x1.ecc2caec51605p-2},
{0x1.ffffffffffffep-2, 0x1.ecc2caec51608p-2},
{0x1.ffffffffffffbp-1, 0x1.c34366179d423p-1},
{0x1.ffffffffffffep-1, 0x1.c34366179d426p-1},
{0x1.fffffffffffd3p+0, 0x1.719218313d073p+0},
{0x1.fffffffffffe1p+0, 0x1.719218313d079p+0},
{0x1.ffffffffffed8p+1, 0x1.0c1f8a6e80ea4p+1},
{0x1.fffffffffff92p+1, 0x1.0c1f8a6e80edp+1},
{0x1.0108b83c4bbc8p-1, 0x1.ee9c256f3947ep-2},
{-0x1.c41e527b70f43p-3, -0x1.c0863c7dece22p-3},
// Julia worst case
{-0x1.02657ff36d5f3p-2, -0x1.ff75bb69b0bf6p-3},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{0x1.0ab3fc30267c2p-1, 0x1.ffd39fc024fbp-2},
};
for (double[] testCase: testCases) {
failures += testAsinhCase(testCase[0], testCase[1]);
}
return failures;
}
private static int testAcosh() {
int failures = 0;
double [][] testCases = {
{0x1.00020000aaaabp+0, 0x1.fffffffff749fp-8},
{0x1.000346de27853p+0, 0x1.47ae147ae274p-7},
{0x1.0008000aaab05p+0, 0x1.fffffffffe9f1p-7},
{0x1.0008000aaab05p+0, 0x1.fffffffffe9f1p-7},
{0x1.002000aaac169p+0, 0x1.fffffffffe67bp-6},
{0x1.002000aaac16bp+0, 0x1.ffffffffff679p-6},
{0x1.00800aab05b1ep+0, 0x1.ffffffffffc9cp-5},
{0x1.00800aab05b1fp+0, 0x1.ffffffffffe9bp-5},
{0x1.0147f40224b2ep+0, 0x1.9999999999318p-4},
{0x1.0147f40224b35p+0, 0x1.9999999999776p-4},
{0x1.0200aac16db6cp+0, 0x1.ffffffffffe91p-4},
{0x1.0200aac16db6ep+0, 0x1.fffffffffff91p-4},
{0x1.080ab05ca613bp+0, 0x1.ffffffffffea5p-3},
{0x1.080ab05ca6146p+0, 0x1.0000000000001p-2},
{0x1.20ac1862ae8cep+0, 0x1.fffffffffffedp-2},
{0x1.20ac1862ae8dp+0, 0x1.ffffffffffffdp-2},
{0x1.8b07551d9f551p+0, 0x1p+0},
{0x1.e18fa0df2d9b3p+1, 0x1.ffffffffffffbp+0},
{0x1.e18fa0df2d9b8p+1, 0x1.ffffffffffffep+0},
{0x1.e18fa0df2d9bap+1, 0x1.fffffffffffffp+0},
{0x1.b4ee858de3e68p+4, 0x1.ffffffffffff9p+1},
{0x1.b4ee858de3e7ap+4, 0x1.ffffffffffffep+1},
{0x1.b4ee858de3e7dp+4, 0x1.fffffffffffffp+1},
{0x1.749eaa93f4e5ep+10, 0x1.ffffffffffffcp+2},
{0x1.749eaa93f4e64p+10, 0x1.ffffffffffffdp+2},
{0x1.749eaa93f4e76p+10, 0x1p+3},
{0x1.0f2ebd0a7fb9p+22, 0x1.fffffffffff6fp+3},
{0x1.0f2ebd0a8005cp+22, 0x1p+4},
{0x1.1f43fcc4b6316p+45, 0x1.fffffffffffd3p+4},
{0x1.1f43fcc4b662cp+45, 0x1.fffffffffffffp+4},
{0x1.fdf25fc26e7cp+1023, 0x1.633c654fee2bap+9},
{0x1.fdf25fc26e7cp+1023, 0x1.633c654fee2bap+9},
{0x1.e0976c8f0ebdfp+1, 0x1.ff76fb3f476d5p+0},
{0x1.ff66e0de4dc6fp+1023, 0x1.633cc2ae1c934p+9},
{0x1.f97ccb0aef314p+11, 0x1.1ff088806d82ep+3},
{0x1.fdf28623ef923p+1021, 0x1.628af341989dap+9},
// Julia worst case
{0x1.0001ff6afc4bap+0, 0x1.ffb5238940116p-8},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{0x1.0007fd4307b75p+0, 0x1.ffa704d280935p-7},
{0x1.071334daf83adp+0, 0x1.e063ca7176ffdp-3},
{0x1.1d7bc19163966p+0, 0x1.e6db4d68a00dcp-2},
};
for (double[] testCase: testCases) {
failures += testAcoshCase(testCase[0], testCase[1]);
}
return failures;
}
private static int testAtanh() {
int failures = 0;
double [][] testCases = {
{0x1.5798ee2308c36p-27, 0x1.5798ee2308c37p-27},
{0x1.ffffffffffffep-26, 0x1p-25},
{0x1.ffffffffffffep-25, 0x1.0000000000004p-24},
{0x1.ad7f29abcaf47p-24, 0x1.ad7f29abcaf6p-24},
{0x1.ad7f29abcaf48p-24, 0x1.ad7f29abcaf61p-24},
{0x1.ffffffffffffep-24, 0x1.0000000000014p-23},
{0x1.ffffffffffffep-23, 0x1.0000000000054p-22},
{0x1.ffffffffffffep-22, 0x1.0000000000154p-21},
{0x1.ffffffffffffep-21, 0x1.0000000000554p-20},
{0x1.0c6f7a0b5ed8dp-20, 0x1.0c6f7a0b5f3b3p-20},
{0x1.ffffffffffffep-20, 0x1.0000000001554p-19},
{0x1.ffffffffffffep-19, 0x1.0000000005554p-18},
{0x1.fffffffffffffp-18, 0x1.0000000015555p-17},
{0x1p-17, 0x1.0000000015555p-17},
{0x1.4f8b588e368edp-17, 0x1.4f8b588e6698bp-17},
{0x1.fffffffffffffp-17, 0x1.0000000055555p-16},
{0x1.fffffffffffffp-16, 0x1.0000000155555p-15},
{0x1p-15, 0x1.0000000155555p-15},
{0x1.fffffffffe5ddp-15, 0x1.0000000554844p-14},
{0x1.fffffffffffffp-15, 0x1.0000000555555p-14},
{0x1.a36e2eb1c432dp-14, 0x1.a36e2ec938ff8p-14},
{0x1.ffffffffffffep-14, 0x1.0000001555555p-13},
{0x1p-13, 0x1.0000001555556p-13},
{0x1.ffffffffffd51p-13, 0x1.0000005555401p-12},
{0x1.fffffffffffffp-13, 0x1.0000005555559p-12},
{0x1.ffffffffffffep-12, 0x1.0000015555587p-11},
{0x1p-11, 0x1.0000015555588p-11},
{0x1.fffffffffff1p-11, 0x1.0000055555811p-10},
{0x1p-10, 0x1.0000055555889p-10},
{0x1.0624dd2f1a9c6p-10, 0x1.0624e2e91ece1p-10},
{0x1.0624dd2f1a9f8p-10, 0x1.0624e2e91ed13p-10},
{0x1.fffffffffffddp-10, 0x1.0000155558877p-9},
{0x1.fffffffffffffp-10, 0x1.0000155558888p-9},
{0x1.ffffffffffffcp-9, 0x1.0000555588889p-8},
{0x1.ffffffffffffep-9, 0x1.000055558888ap-8},
{0x1.ffffffffffff8p-8, 0x1.0001555888917p-7},
{0x1.ffffffffffffep-8, 0x1.000155588891ap-7},
{0x1.47ae147ae1458p-7, 0x1.47b0e059d0574p-7},
{0x1.47ae147ae1464p-7, 0x1.47b0e059d058p-7},
{0x1.ffffffffffffep-7, 0x1.000555888ad1bp-6},
{0x1.fffffffffffffp-7, 0x1.000555888ad1cp-6},
{0x1.ffffffffffff9p-6, 0x1.001558891aedep-5},
{0x1.ffffffffffffep-6, 0x1.001558891aee1p-5},
{0x1.ffffffffffff9p-5, 0x1.005588ad375a9p-4},
{0x1.fffffffffffffp-5, 0x1.005588ad375acp-4},
{0x1.9999999999996p-4, 0x1.9af93cd23440ep-4},
{0x1.9999999999997p-4, 0x1.9af93cd23440fp-4},
{0x1.fffffffffffffp-4, 0x1.015891c9eaef7p-3},
{0x1p-3, 0x1.015891c9eaef7p-3},
{0x1.fffffffffffffp-3, 0x1.058aefa811451p-2},
{0x1.ffffffffffffcp-2, 0x1.193ea7aad0308p-1},
{0x1.ffffffffffffep-2, 0x1.193ea7aad0309p-1},
{0x1.ffffffffffffbp-1, 0x1.1e9067763b478p+4},
{0x1.ffffffffffffep-1, 0x1.25e4f7b2737fap+4},
// Julia worst case
{-0x1.f97fabc0650c4p-4, -0x1.fc16bb2fd3672p-4},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{0x1.ffd834a270fp-10, 0x1.ffd85f432fed2p-10},
{-0x1.ffbe8dd88527fp-9, -0x1.ffbf38422c2dbp-9},
{-0x1.e7c1f36602014p-4, -0x1.ea153d6c96817p-4},
};
for (double[] testCase: testCases)
failures += testAtanhCase(testCase[0], testCase[1]);
return failures;
}
}

View file

@ -0,0 +1,747 @@
/*
* Copyright (c) 2003, 2024, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4851638
* @key randomness
* @summary Tests for StrictMath.hypot
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build HypotTests
* @run main HypotTests
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/HypotTests.java test properties that should
* hold for any hypot implementation, including the FDLIBM-based one
* required for StrictMath.hypot. Therefore, the test cases in
* ../Math/HypotTests.java are run against both the Math and
* StrictMath versions of hypot. The role of this test is to verify
* that the FDLIBM hypot algorithm is being used by running golden
* file tests on values that may vary from one conforming hypot
* implementation to another.
*/
public class HypotTests {
private HypotTests(){}
public static void main(String... args) {
int failures = 0;
failures += testHypot();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing hypot incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
/**
* The hypot implementation is commutative, {@code hypot(a, b) ==
* hypot(b, a)}, and independent of sign, {@code hypot(a, b) ==
* hypot(-a, b) == hypot(a, -b) == hypot(-a, -b)}.
*/
static int testHypotCase(double input1, double input2, double expected) {
int failures = 0;
failures += Tests.test("StrictMath.hypot(double)", input1, input2,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", input2, input1,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", -input1, input2,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", input2, -input1,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", input1, -input2,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", -input2, input1,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", -input1, -input2,
StrictMath::hypot, expected);
failures += Tests.test("StrictMath.hypot(double)", -input2, -input1,
StrictMath::hypot, expected);
return failures;
}
static int testHypot() {
int failures = 0;
double [][] testCases = {
{0x1.0p0, 0x1.ffffffffffab5p-1, 0x1.6a09e667f39edp0},
{0x1.0p0, 0x1.ffffffffffffbp0, 0x1.1e3779b97f4a6p1},
{0x1.0p0, 0x1.7ffffffffffffp1, 0x1.94c583ada5b51p1},
{0x1.0p0, 0x1.ffffffffffffdp1, 0x1.07e0f66afed06p2},
{0x1.0p0, 0x1.3fffffffffffdp2, 0x1.465655f122ff3p2},
{0x1.0p0, 0x1.4p2, 0x1.465655f122ff6p2},
{0x1.0p0, 0x1.7ffffffffffffp2, 0x1.854bfb363dc38p2},
{0x1.0p0, 0x1.8p2, 0x1.854bfb363dc39p2},
{0x1.0p0, 0x1.bfffffffffffep2, 0x1.c48c6001f0abdp2},
{0x1.0p0, 0x1.fffffffffffffp2, 0x1.01fe03f61badp3},
{0x1.0p0, 0x1.1fffffffffffap3, 0x1.21c5b70d9f81dp3},
{0x1.0p0, 0x1.3ffffffffffe5p3, 0x1.419894c2329d5p3},
{0x1.0p0, 0x1.3ffffffffffe7p3, 0x1.419894c2329d8p3},
{0x1.0p0, 0x1.5ffffffffff7ep3, 0x1.617398f2aa9c6p3},
{0x1.0p0, 0x1.5ffffffffff8dp3, 0x1.617398f2aa9d5p3},
{0x1.0p0, 0x1.7ffffffffff9bp3, 0x1.8154be27734c1p3},
{0x1.0p0, 0x1.8p3, 0x1.8154be2773526p3},
{0x1.0p0, 0x1.9fffffffffff4p3, 0x1.a13a9cb996644p3},
{0x1.0p0, 0x1.9ffffffffffffp3, 0x1.a13a9cb99664fp3},
{0x1.0p0, 0x1.bfffffffffffep3, 0x1.c12432fec0327p3},
{0x1.0p0, 0x1.cp3, 0x1.c12432fec0329p3},
{0x1.0p0, 0x1.dffffffffffbcp3, 0x1.e110c39105f6bp3},
{0x1.0p0, 0x1.ep3, 0x1.e110c39105fafp3},
{0x1.0p0, 0x1.ffffffffffeafp3, 0x1.007fe00ff5fc8p4},
{0x1.0p0, 0x1.0fffffffffff4p4, 0x1.10785dd689a1cp4},
{0x1.0p0, 0x1.0fffffffffffbp4, 0x1.10785dd689a23p4},
{0x1.0p0, 0x1.1ffffffffff92p4, 0x1.2071b0abcd7cap4},
{0x1.0p0, 0x1.1ffffffffff99p4, 0x1.2071b0abcd7d1p4},
{0x1.0p0, 0x1.2fffffffffffcp4, 0x1.306bb705ae7bfp4},
{0x1.0p0, 0x1.2ffffffffffffp4, 0x1.306bb705ae7c3p4},
{0x1.0p0, 0x1.3fffffffffffdp4, 0x1.4066560954a8bp4},
{0x1.0p0, 0x1.4fffffffffe14p4, 0x1.506177f548fcfp4},
{0x1.0p0, 0x1.5p4, 0x1.506177f5491bbp4},
{0x1.0p0, 0x1.5fffffffffffdp4, 0x1.605d0af9d3a42p4},
{0x1.0p0, 0x1.5fffffffffffep4, 0x1.605d0af9d3a42p4},
{0x1.0p0, 0x1.6fffffffffff8p4, 0x1.7059005e2c015p4},
{0x1.0p0, 0x1.6ffffffffffffp4, 0x1.7059005e2c01dp4},
{0x1.0p0, 0x1.7fffffffffffdp4, 0x1.80554bdc2dc4dp4},
{0x1.0p0, 0x1.7ffffffffffffp4, 0x1.80554bdc2dc4ep4},
{0x1.0p0, 0x1.8fffffffffe68p4, 0x1.9051e3235a2cp4},
{0x1.0p0, 0x1.9p4, 0x1.9051e3235a458p4},
{0x1.0p0, 0x1.9fffffffffff4p4, 0x1.a04ebd789d00cp4},
{0x1.0p0, 0x1.ap4, 0x1.a04ebd789d019p4},
{0x1.0p0, 0x1.afffffffffed8p4, 0x1.b04bd36b639fbp4},
{0x1.0p0, 0x1.affffffffff43p4, 0x1.b04bd36b63a66p4},
{0x1.0p0, 0x1.bfffffffffe3ep4, 0x1.c0491e9ab90fdp4},
{0x1.0p0, 0x1.cp4, 0x1.c0491e9ab92bfp4},
{0x1.0p0, 0x1.cfffffffffed8p4, 0x1.d0469986884d6p4},
{0x1.0p0, 0x1.cfffffffffee8p4, 0x1.d0469986884e5p4},
{0x1.0p0, 0x1.dfffffffffe5cp4, 0x1.e0443f6a33104p4},
{0x1.0p0, 0x1.dffffffffffffp4, 0x1.e0443f6a332a7p4},
{0x1.0p0, 0x1.efffffffffff8p4, 0x1.f0420c1e63084p4},
{0x1.0p0, 0x1.fp4, 0x1.f0420c1e6308dp4},
{0x1.0p0, 0x1.ffffffffffffdp4, 0x1.001ffe003ff5fp5},
{0x1.0p0, 0x1.07ffffffffed8p5, 0x1.081f05ef4d755p5},
{0x1.0p0, 0x1.07ffffffffee8p5, 0x1.081f05ef4d764p5},
{0x1.0p0, 0x1.0fffffffffff4p5, 0x1.101e1c7371c6bp5},
{0x1.0p0, 0x1.0fffffffffffbp5, 0x1.101e1c7371c72p5},
{0x1.0p0, 0x1.17ffffffffff8p5, 0x1.181d404cf7f51p5},
{0x1.0p0, 0x1.17ffffffffffdp5, 0x1.181d404cf7f56p5},
{0x1.0p0, 0x1.1fffffffffbf2p5, 0x1.201c705fa7a27p5},
{0x1.0p0, 0x1.1fffffffffc65p5, 0x1.201c705fa7a9ap5},
{0x1.0p0, 0x1.27ffffffffe08p5, 0x1.281babadfba01p5},
{0x1.0p0, 0x1.28p5, 0x1.281babadfbbf9p5},
{0x1.0p0, 0x1.2ffffffffff64p5, 0x1.301af15517357p5},
{0x1.0p0, 0x1.2ffffffffff6cp5, 0x1.301af1551735ep5},
{0x1.0p0, 0x1.37ffffffffc78p5, 0x1.381a40895d3f5p5},
{0x1.0p0, 0x1.37ffffffffc88p5, 0x1.381a40895d406p5},
{0x1.0p0, 0x1.3fffffffffffdp5, 0x1.4019989389b2dp5},
{0x1.0p0, 0x1.4p5, 0x1.4019989389b3p5},
{0x1.0p0, 0x1.47fffffffffe8p5, 0x1.4818f8ce34e19p5},
{0x1.0p0, 0x1.47ffffffffffap5, 0x1.4818f8ce34e2cp5},
{0x1.0p0, 0x1.4fffffffffa64p5, 0x1.501860a3b54bep5},
{0x1.0p0, 0x1.4fffffffffe47p5, 0x1.501860a3b58a1p5},
{0x1.0p0, 0x1.57ffffffffff8p5, 0x1.5817cf8c4c199p5},
{0x1.0p0, 0x1.57fffffffffffp5, 0x1.5817cf8c4c1ap5},
{0x1.0p0, 0x1.5fffffffffbeep5, 0x1.6017450c8d3e7p5},
{0x1.0p0, 0x1.6p5, 0x1.6017450c8d7f9p5},
{0x1.0p0, 0x1.67fffffffffe8p5, 0x1.6816c0b405afp5},
{0x1.0p0, 0x1.68p5, 0x1.6816c0b405b09p5},
{0x1.0p0, 0x1.6fffffffffb78p5, 0x1.7016421c06043p5},
{0x1.0p0, 0x1.7p5, 0x1.7016421c064cbp5},
{0x1.0p0, 0x1.77ffffffffffp5, 0x1.7815c8e69cc37p5},
{0x1.0p0, 0x1.77ffffffffffcp5, 0x1.7815c8e69cc43p5},
{0x1.0p0, 0x1.7ffffffffffffp5, 0x1.801554bda99c5p5},
{0x1.0p0, 0x1.87fffffffffdp5, 0x1.8814e55214271p5},
{0x1.0p0, 0x1.87ffffffffffcp5, 0x1.8814e5521429ep5},
{0x1.0p0, 0x1.8ffffffffffe8p5, 0x1.90147a5b16ce5p5},
{0x1.0p0, 0x1.8fffffffffffcp5, 0x1.90147a5b16cfap5},
{0x1.0p0, 0x1.97ffffffffffp5, 0x1.98141395a0592p5},
{0x1.0p0, 0x1.97fffffffffffp5, 0x1.98141395a05a1p5},
{0x1.0p0, 0x1.9fffffffff8f4p5, 0x1.a013b0c3c7377p5},
{0x1.0p0, 0x1.9fffffffffb18p5, 0x1.a013b0c3c759bp5},
{0x1.0p0, 0x1.a7fffffffffdp5, 0x1.a81351ac4f317p5},
{0x1.0p0, 0x1.a7ffffffffffp5, 0x1.a81351ac4f338p5},
{0x1.0p0, 0x1.afffffffff698p5, 0x1.b012f61a35d98p5},
{0x1.0p0, 0x1.bp5, 0x1.b012f61a367p5},
{0x1.0p0, 0x1.b7ffffffff85p5, 0x1.b8129ddc56b26p5},
{0x1.0p0, 0x1.b7ffffffff87p5, 0x1.b8129ddc56b45p5},
{0x1.0p0, 0x1.bfffffffffffdp5, 0x1.c01248c50d99cp5},
{0x1.0p0, 0x1.bfffffffffffep5, 0x1.c01248c50d99cp5},
{0x1.0p0, 0x1.c7ffffffffedp5, 0x1.c811f6a9e9676p5},
{0x1.0p0, 0x1.c8p5, 0x1.c811f6a9e97a6p5},
{0x1.0p0, 0x1.cffffffffffe8p5, 0x1.d011a7636789ep5},
{0x1.0p0, 0x1.d7ffffffffffp5, 0x1.d8115accb20f3p5},
{0x1.0p0, 0x1.d8p5, 0x1.d8115accb2103p5},
{0x1.0p0, 0x1.dfffffffffebcp5, 0x1.e01110c367a41p5},
{0x1.0p0, 0x1.ep5, 0x1.e01110c367b85p5},
{0x1.0p0, 0x1.e7fffffffffdp5, 0x1.e810c927681fap5},
{0x1.0p0, 0x1.e8p5, 0x1.e810c9276822ap5},
{0x1.0p0, 0x1.efffffffff7f8p5, 0x1.f01083daa4dadp5},
{0x1.0p0, 0x1.fp5, 0x1.f01083daa55b5p5},
{0x1.0p0, 0x1.f7ffffffffffp5, 0x1.f81040c0f9c6p5},
{0x1.0p0, 0x1.f8p5, 0x1.f81040c0f9c71p5},
{0x1.0p0, 0x1.fffffffffffffp5, 0x1.0007ffe000fffp6},
{0x1.0p0, 0x1.03fffffffffdp6, 0x1.0407e05f7d188p6},
{0x1.0p0, 0x1.03ffffffffffbp6, 0x1.0407e05f7d1b4p6},
{0x1.0p0, 0x1.07ffffffff7f8p6, 0x1.0807c1d34edd5p6},
{0x1.0p0, 0x1.07ffffffff808p6, 0x1.0807c1d34ede4p6},
{0x1.0p0, 0x1.0bffffffff65p6, 0x1.0c07a430870e5p6},
{0x1.0p0, 0x1.0bffffffff67p6, 0x1.0c07a43087104p6},
{0x1.0p0, 0x1.0fffffffffc54p6, 0x1.1007876cda509p6},
{0x1.0p0, 0x1.0fffffffffe0dp6, 0x1.1007876cda6c2p6},
{0x1.0p0, 0x1.13fffffffffdp6, 0x1.14076b7e954b4p6},
{0x1.0p0, 0x1.13ffffffffffep6, 0x1.14076b7e954e3p6},
{0x1.0p0, 0x1.17ffffffffff8p6, 0x1.1807505c9310dp6},
{0x1.0p0, 0x1.18p6, 0x1.1807505c93116p6},
{0x1.0p0, 0x1.1bfffffffecbp6, 0x1.1c0735fe3197ap6},
{0x1.0p0, 0x1.1bffffffff1dbp6, 0x1.1c0735fe31ea5p6},
{0x1.0p0, 0x1.1ffffffffebcap6, 0x1.20071c5b4ce64p6},
{0x1.0p0, 0x1.1fffffffffaf1p6, 0x1.20071c5b4dd8bp6},
{0x1.0p0, 0x1.23ffffffff83p6, 0x1.2407036c309fdp6},
{0x1.0p0, 0x1.23ffffffff85p6, 0x1.2407036c30a1cp6},
{0x1.0p0, 0x1.27ffffffffba8p6, 0x1.2806eb2991e76p6},
{0x1.0p0, 0x1.28p6, 0x1.2806eb29922cep6},
{0x1.0p0, 0x1.2bfffffffff7p6, 0x1.2c06d38c8b4ffp6},
{0x1.0p0, 0x1.2bfffffffff9p6, 0x1.2c06d38c8b52p6},
{0x1.0p0, 0x1.2fffffffffff4p6, 0x1.3006bc8e938c8p6},
{0x1.0p0, 0x1.2fffffffffffcp6, 0x1.3006bc8e938cfp6},
{0x1.0p0, 0x1.33ffffffff87p6, 0x1.3406a6297821ep6},
{0x1.0p0, 0x1.33ffffffff89p6, 0x1.3406a6297823dp6},
{0x1.0p0, 0x1.37ffffffff9d8p6, 0x1.380690575943dp6},
{0x1.0p0, 0x1.37ffffffff9eap6, 0x1.380690575944fp6},
{0x1.0p0, 0x1.3bffffffffffp6, 0x1.3c067b12a2013p6},
{0x1.0p0, 0x1.3cp6, 0x1.3c067b12a2024p6},
{0x1.0p0, 0x1.3fffffffffe19p6, 0x1.40066656044ep6},
{0x1.0p0, 0x1.4p6, 0x1.40066656046c7p6},
{0x1.0p0, 0x1.43ffffffff1dp6, 0x1.4406521c75c3p6},
{0x1.0p0, 0x1.43ffffffffccfp6, 0x1.4406521c7672fp6},
{0x1.0p0, 0x1.47ffffffff8a8p6, 0x1.48063e612ce7ap6},
{0x1.0p0, 0x1.47ffffffffcb9p6, 0x1.48063e612d28bp6},
{0x1.0p0, 0x1.4bfffffffe1fp6, 0x1.4c062b1f96823p6},
{0x1.0p0, 0x1.4cp6, 0x1.4c062b1f98633p6},
{0x1.0p0, 0x1.4ffffffffde04p6, 0x1.500618535d07dp6},
{0x1.0p0, 0x1.5p6, 0x1.500618535f279p6},
{0x1.0p0, 0x1.53fffffffef1p6, 0x1.540605f85c637p6},
{0x1.0p0, 0x1.53ffffffffdf3p6, 0x1.540605f85d51ap6},
{0x1.0p0, 0x1.57ffffffffff8p6, 0x1.5805f40aa0595p6},
{0x1.0p0, 0x1.5bffffffffffp6, 0x1.5c05e286636b5p6},
{0x1.0p0, 0x1.5bfffffffffffp6, 0x1.5c05e286636c4p6},
{0x1.0p0, 0x1.5ffffffffd9cep6, 0x1.6005d1680baa2p6},
{0x1.0p0, 0x1.5fffffffff873p6, 0x1.6005d1680d947p6},
{0x1.0p0, 0x1.63ffffffffa5p6, 0x1.6405c0ac30a35p6},
{0x1.0p0, 0x1.63ffffffffa7p6, 0x1.6405c0ac30a56p6},
{0x1.0p0, 0x1.67ffffffff988p6, 0x1.6805b04f83ac3p6},
{0x1.0p0, 0x1.68p6, 0x1.6805b04f8413bp6},
{0x1.0p0, 0x1.6bfffffffffep6, 0x1.6c05a04ee40c3p6},
{0x1.0p0, 0x1.6cp6, 0x1.6c05a04ee40e3p6},
{0x1.0p0, 0x1.6fffffffff018p6, 0x1.700590a74f9b5p6},
{0x1.0p0, 0x1.6fffffffffbe2p6, 0x1.700590a75057fp6},
{0x1.0p0, 0x1.73ffffffff4ap6, 0x1.74058155e9b72p6},
{0x1.0p0, 0x1.74p6, 0x1.74058155ea6d2p6},
{0x1.0p0, 0x1.77ffffffffffp6, 0x1.78057257f1868p6},
{0x1.0p0, 0x1.78p6, 0x1.78057257f1878p6},
{0x1.0p0, 0x1.7bfffffffffep6, 0x1.7c0563aac389bp6},
{0x1.0p0, 0x1.7bfffffffffe4p6, 0x1.7c0563aac389fp6},
{0x1.0p0, 0x1.7ffffffffffffp6, 0x1.8005554bda349p6},
{0x1.0p0, 0x1.8p6, 0x1.8005554bda34bp6},
{0x1.0p0, 0x1.83fffffffffap6, 0x1.84054738c9dcdp6},
{0x1.0p0, 0x1.84p6, 0x1.84054738c9e2dp6},
{0x1.0p0, 0x1.87ffffffff09p6, 0x1.8805396f3f494p6},
{0x1.0p0, 0x1.87ffffffff0bp6, 0x1.8805396f3f4b5p6},
{0x1.0p0, 0x1.8bfffffffffep6, 0x1.8c052bed02f7ap6},
{0x1.0p0, 0x1.8cp6, 0x1.8c052bed02f9bp6},
{0x1.0p0, 0x1.8fffffffff7c8p6, 0x1.90051eafee07bp6},
{0x1.0p0, 0x1.9p6, 0x1.90051eafee8b3p6},
{0x1.0p1, 0x1.fffffffffdcb5p-1, 0x1.1e3779b97f0b5p1},
{0x1.0p1, 0x1.ffffffffffab5p0, 0x1.6a09e667f39edp1},
{0x1.0p1, 0x1.7ffffffffffffp1, 0x1.cd82b446159f2p1},
{0x1.0p1, 0x1.8p1, 0x1.cd82b446159f3p1},
{0x1.0p1, 0x1.ffffffffffffbp1, 0x1.1e3779b97f4a6p2},
{0x1.0p1, 0x1.3fffffffffffdp2, 0x1.58a68a4a8d9fp2},
{0x1.0p1, 0x1.3fffffffffffep2, 0x1.58a68a4a8d9f1p2},
{0x1.0p1, 0x1.7ffffffffffffp2, 0x1.94c583ada5b51p2},
{0x1.0p1, 0x1.bfffffffffffep2, 0x1.d1ed52076fbe7p2},
{0x1.0p1, 0x1.cp2, 0x1.d1ed52076fbe9p2},
{0x1.0p1, 0x1.ffffffffffffdp2, 0x1.07e0f66afed06p3},
{0x1.0p1, 0x1.1fffffffffff2p3, 0x1.2706821902e8cp3},
{0x1.0p1, 0x1.2p3, 0x1.2706821902e9ap3},
{0x1.0p1, 0x1.3fffffffffffdp3, 0x1.465655f122ff3p3},
{0x1.0p1, 0x1.4p3, 0x1.465655f122ff6p3},
{0x1.0p1, 0x1.5ffffffffffd6p3, 0x1.65c55827df1a8p3},
{0x1.0p1, 0x1.7ffffffffffffp3, 0x1.854bfb363dc38p3},
{0x1.0p1, 0x1.8p3, 0x1.854bfb363dc39p3},
{0x1.0p1, 0x1.9ffffffffffe4p3, 0x1.a4e4efeda34c2p3},
{0x1.0p1, 0x1.ap3, 0x1.a4e4efeda34dep3},
{0x1.0p1, 0x1.bfffffffffffep3, 0x1.c48c6001f0abdp3},
{0x1.0p1, 0x1.dfffffffffffcp3, 0x1.e43f746f77956p3},
{0x1.0p1, 0x1.ep3, 0x1.e43f746f7795bp3},
{0x1.0p1, 0x1.fffffffffffffp3, 0x1.01fe03f61badp4},
{0x1.0p1, 0x1.0ffffffffffc4p4, 0x1.11e039f40ee2ap4},
{0x1.0p1, 0x1.0ffffffffffc7p4, 0x1.11e039f40ee2dp4},
{0x1.0p1, 0x1.1fffffffffffap4, 0x1.21c5b70d9f81dp4},
{0x1.0p1, 0x1.2fffffffffffcp4, 0x1.31adf859f9e5ap4},
{0x1.0p1, 0x1.2fffffffffffep4, 0x1.31adf859f9e5cp4},
{0x1.0p1, 0x1.3ffffffffffe5p4, 0x1.419894c2329d5p4},
{0x1.0p1, 0x1.3ffffffffffe7p4, 0x1.419894c2329d8p4},
{0x1.0p1, 0x1.4fffffffffff4p4, 0x1.518536f3ca668p4},
{0x1.0p1, 0x1.5p4, 0x1.518536f3ca675p4},
{0x1.0p1, 0x1.5ffffffffff7ep4, 0x1.617398f2aa9c6p4},
{0x1.0p1, 0x1.5ffffffffff8dp4, 0x1.617398f2aa9d5p4},
{0x1.0p1, 0x1.6ffffffffffb8p4, 0x1.716380ce70352p4},
{0x1.0p1, 0x1.7p4, 0x1.716380ce7039ap4},
{0x1.0p1, 0x1.7ffffffffff9bp4, 0x1.8154be27734c1p4},
{0x1.0p1, 0x1.8p4, 0x1.8154be2773526p4},
{0x1.0p1, 0x1.8ffffffffffe8p4, 0x1.9147284a4142fp4},
{0x1.0p1, 0x1.8ffffffffffffp4, 0x1.9147284a41446p4},
{0x1.0p1, 0x1.9fffffffffff4p4, 0x1.a13a9cb996644p4},
{0x1.0p1, 0x1.9ffffffffffffp4, 0x1.a13a9cb99664fp4},
{0x1.0p1, 0x1.affffffffff58p4, 0x1.b12efe0a8f113p4},
{0x1.0p1, 0x1.affffffffffd2p4, 0x1.b12efe0a8f18dp4},
{0x1.0p1, 0x1.bfffffffffffep4, 0x1.c12432fec0327p4},
{0x1.0p1, 0x1.cp4, 0x1.c12432fec0329p4},
{0x1.0p1, 0x1.cffffffffffe8p4, 0x1.d11a25cd6ed78p4},
{0x1.0p1, 0x1.dp4, 0x1.d11a25cd6ed91p4},
{0x1.0p1, 0x1.dffffffffffbcp4, 0x1.e110c39105f6bp4},
{0x1.0p1, 0x1.ep4, 0x1.e110c39105fafp4},
{0x1.0p1, 0x1.effffffffffe8p4, 0x1.f107fbd0adcf1p4},
{0x1.0p1, 0x1.efffffffffff8p4, 0x1.f107fbd0addp4},
{0x1.0p1, 0x1.ffffffffffeafp4, 0x1.007fe00ff5fc8p5},
{0x1.0p1, 0x1.07fffffffffe8p5, 0x1.087c01e7d5092p5},
{0x1.0p1, 0x1.08p5, 0x1.087c01e7d50abp5},
{0x1.0p1, 0x1.0fffffffffff4p5, 0x1.10785dd689a1cp5},
{0x1.0p1, 0x1.0fffffffffffbp5, 0x1.10785dd689a23p5},
{0x1.0p1, 0x1.17ffffffffed8p5, 0x1.1874eee5c5cb1p5},
{0x1.0p1, 0x1.17ffffffffee8p5, 0x1.1874eee5c5cc2p5},
{0x1.0p1, 0x1.1ffffffffff92p5, 0x1.2071b0abcd7cap5},
{0x1.0p1, 0x1.1ffffffffff99p5, 0x1.2071b0abcd7d1p5},
{0x1.0p1, 0x1.27ffffffffea8p5, 0x1.286e9f388de9fp5},
{0x1.0p1, 0x1.28p5, 0x1.286e9f388dff7p5},
{0x1.0p1, 0x1.2fffffffffffcp5, 0x1.306bb705ae7bfp5},
{0x1.0p1, 0x1.2ffffffffffffp5, 0x1.306bb705ae7c3p5},
{0x1.0p1, 0x1.37ffffffffff8p5, 0x1.3868f4e9108b9p5},
{0x1.0p1, 0x1.38p5, 0x1.3868f4e9108c1p5},
{0x1.0p1, 0x1.3fffffffffffdp5, 0x1.4066560954a8bp5},
{0x1.0p1, 0x1.47ffffffffe28p5, 0x1.4863d7d40ad39p5},
{0x1.0p1, 0x1.48p5, 0x1.4863d7d40af11p5},
{0x1.0p1, 0x1.4fffffffffe14p5, 0x1.506177f548fcfp5},
{0x1.0p1, 0x1.5p5, 0x1.506177f5491bbp5},
{0x1.0p1, 0x1.57ffffffffeb8p5, 0x1.585f34506bafbp5},
{0x1.0p1, 0x1.58p5, 0x1.585f34506bc43p5},
{0x1.0p1, 0x1.5fffffffffffdp5, 0x1.605d0af9d3a42p5},
{0x1.0p1, 0x1.5fffffffffffep5, 0x1.605d0af9d3a42p5},
{0x1.0p1, 0x1.67ffffffffda8p5, 0x1.685afa317791bp5},
{0x1.0p1, 0x1.68p5, 0x1.685afa3177b73p5},
{0x1.0p1, 0x1.6fffffffffff8p5, 0x1.7059005e2c015p5},
{0x1.0p1, 0x1.6ffffffffffffp5, 0x1.7059005e2c01dp5},
{0x1.0p1, 0x1.77ffffffffffp5, 0x1.78571c0982328p5},
{0x1.0p1, 0x1.78p5, 0x1.78571c0982339p5},
{0x1.0p1, 0x1.7fffffffffffdp5, 0x1.80554bdc2dc4dp5},
{0x1.0p1, 0x1.7ffffffffffffp5, 0x1.80554bdc2dc4ep5},
{0x1.0p1, 0x1.87fffffffffdp5, 0x1.88538e9ad8dacp5},
{0x1.0p1, 0x1.87fffffffffffp5, 0x1.88538e9ad8ddbp5},
{0x1.0p1, 0x1.8fffffffffe68p5, 0x1.9051e3235a2cp5},
{0x1.0p1, 0x1.9p5, 0x1.9051e3235a458p5},
{0x1.0p1, 0x1.97ffffffffffp5, 0x1.9850486a3f17p5},
{0x1.0p1, 0x1.97fffffffffffp5, 0x1.9850486a3f17fp5},
{0x1.0p1, 0x1.9fffffffffff4p5, 0x1.a04ebd789d00cp5},
{0x1.0p1, 0x1.ap5, 0x1.a04ebd789d019p5},
{0x1.0p1, 0x1.a7ffffffffe1p5, 0x1.a84d416a2354dp5},
{0x1.0p1, 0x1.a8p5, 0x1.a84d416a2373dp5},
{0x1.0p1, 0x1.afffffffffed8p5, 0x1.b04bd36b639fbp5},
{0x1.0p1, 0x1.affffffffff43p5, 0x1.b04bd36b63a66p5},
{0x1.0p1, 0x1.b7ffffffffd7p5, 0x1.b84a72b848951p5},
{0x1.0p1, 0x1.b7ffffffffe2bp5, 0x1.b84a72b848a0cp5},
{0x1.0p1, 0x1.bfffffffffe3ep5, 0x1.c0491e9ab90fdp5},
{0x1.0p1, 0x1.cp5, 0x1.c0491e9ab92bfp5},
{0x1.0p1, 0x1.c7fffffffffdp5, 0x1.c847d6695dbc5p5},
{0x1.0p1, 0x1.c8p5, 0x1.c847d6695dbf6p5},
{0x1.0p1, 0x1.cfffffffffed8p5, 0x1.d0469986884d6p5},
{0x1.0p1, 0x1.cfffffffffee8p5, 0x1.d0469986884e5p5},
{0x1.0p1, 0x1.d7ffffffffdfp5, 0x1.d845675f37721p5},
{0x1.0p1, 0x1.d8p5, 0x1.d845675f37931p5},
{0x1.0p1, 0x1.dfffffffffe5cp5, 0x1.e0443f6a33104p5},
{0x1.0p1, 0x1.dffffffffffffp5, 0x1.e0443f6a332a7p5},
{0x1.0p1, 0x1.e7fffffffff05p5, 0x1.e84321273f31ep5},
{0x1.0p1, 0x1.e7fffffffff1p5, 0x1.e84321273f328p5},
{0x1.0p1, 0x1.efffffffffff8p5, 0x1.f0420c1e63084p5},
{0x1.0p1, 0x1.fp5, 0x1.f0420c1e6308dp5},
{0x1.0p1, 0x1.f7ffffffffc3p5, 0x1.f840ffdf40effp5},
{0x1.0p1, 0x1.f7fffffffff08p5, 0x1.f840ffdf411d7p5},
{0x1.0p1, 0x1.ffffffffffffdp5, 0x1.001ffe003ff5fp6},
{0x1.0p1, 0x1.03fffffffffdp6, 0x1.041f800f9f928p6},
{0x1.0p1, 0x1.03ffffffffffap6, 0x1.041f800f9f953p6},
{0x1.0p1, 0x1.07ffffffffed8p6, 0x1.081f05ef4d755p6},
{0x1.0p1, 0x1.07ffffffffee8p6, 0x1.081f05ef4d764p6},
{0x1.0p1, 0x1.0bfffffffff5p6, 0x1.0c1e8f739cdcap6},
{0x1.0p1, 0x1.0bfffffffff7p6, 0x1.0c1e8f739cde9p6},
{0x1.0p1, 0x1.0fffffffffff4p6, 0x1.101e1c7371c6bp6},
{0x1.0p1, 0x1.0fffffffffffbp6, 0x1.101e1c7371c72p6},
{0x1.0p1, 0x1.13fffffffffdp6, 0x1.141dacc811a34p6},
{0x1.0p1, 0x1.13ffffffffffcp6, 0x1.141dacc811a6p6},
{0x1.0p1, 0x1.17ffffffffff8p6, 0x1.181d404cf7f51p6},
{0x1.0p1, 0x1.17ffffffffffdp6, 0x1.181d404cf7f56p6},
{0x1.0p1, 0x1.1bffffffffffp6, 0x1.1c1cd6dfae4a5p6},
{0x1.0p1, 0x1.1bffffffffffep6, 0x1.1c1cd6dfae4b4p6},
{0x1.0p1, 0x1.1fffffffffbf2p6, 0x1.201c705fa7a27p6},
{0x1.0p1, 0x1.1fffffffffc65p6, 0x1.201c705fa7a9ap6},
{0x1.0p1, 0x1.23fffffffffdp6, 0x1.241c0cae201cap6},
{0x1.0p1, 0x1.23ffffffffffp6, 0x1.241c0cae201ebp6},
{0x1.0p1, 0x1.27ffffffffe08p6, 0x1.281babadfba01p6},
{0x1.0p1, 0x1.28p6, 0x1.281babadfbbf9p6},
{0x1.0p1, 0x1.2bffffffffc1p6, 0x1.2c1b4d43ac4cfp6},
{0x1.0p1, 0x1.2bffffffffc3p6, 0x1.2c1b4d43ac4eep6},
{0x1.0p1, 0x1.2ffffffffff64p6, 0x1.301af15517357p6},
{0x1.0p1, 0x1.2ffffffffff6cp6, 0x1.301af1551735ep6},
{0x1.0p1, 0x1.33ffffffffadp6, 0x1.341a97c97b22ep6},
{0x1.0p1, 0x1.33ffffffffafp6, 0x1.341a97c97b24fp6},
{0x1.0p1, 0x1.37ffffffffc78p6, 0x1.381a40895d3f5p6},
{0x1.0p1, 0x1.37ffffffffc88p6, 0x1.381a40895d406p6},
{0x1.0p1, 0x1.3bffffffffffp6, 0x1.3c19eb7e71afcp6},
{0x1.0p1, 0x1.3bfffffffffffp6, 0x1.3c19eb7e71b0cp6},
{0x1.0p1, 0x1.3fffffffffffdp6, 0x1.4019989389b2dp6},
{0x1.0p1, 0x1.4p6, 0x1.4019989389b3p6},
{0x1.0p1, 0x1.43fffffffffdp6, 0x1.441947b4829e8p6},
{0x1.0p1, 0x1.43ffffffffff8p6, 0x1.441947b482a11p6},
{0x1.0p1, 0x1.47fffffffffe8p6, 0x1.4818f8ce34e19p6},
{0x1.0p1, 0x1.47ffffffffffap6, 0x1.4818f8ce34e2cp6},
{0x1.0p1, 0x1.4bffffffffffp6, 0x1.4c18abce6501fp6},
{0x1.0p1, 0x1.4bffffffffffcp6, 0x1.4c18abce6502cp6},
{0x1.0p1, 0x1.4fffffffffa64p6, 0x1.501860a3b54bep6},
{0x1.0p1, 0x1.4fffffffffe47p6, 0x1.501860a3b58a1p6},
{0x1.0p1, 0x1.53ffffffffd5p6, 0x1.5418173d9a501p6},
{0x1.0p1, 0x1.53ffffffffd7p6, 0x1.5418173d9a522p6},
{0x1.0p1, 0x1.57ffffffffff8p6, 0x1.5817cf8c4c199p6},
{0x1.0p1, 0x1.57fffffffffffp6, 0x1.5817cf8c4c1ap6},
{0x1.0p1, 0x1.5bffffffff83p6, 0x1.5c178980bc34bp6},
{0x1.0p1, 0x1.5bffffffff988p6, 0x1.5c178980bc4a3p6},
{0x1.0p1, 0x1.5fffffffffbeep6, 0x1.6017450c8d3e7p6},
{0x1.0p1, 0x1.6p6, 0x1.6017450c8d7f9p6},
{0x1.0p1, 0x1.63fffffffffdp6, 0x1.6417022204f99p6},
{0x1.0p1, 0x1.67fffffffffe8p6, 0x1.6816c0b405afp6},
{0x1.0p1, 0x1.68p6, 0x1.6816c0b405b09p6},
{0x1.0p1, 0x1.6bfffffffffep6, 0x1.6c1680b6059e8p6},
{0x1.0p1, 0x1.6cp6, 0x1.6c1680b605a08p6},
{0x1.0p1, 0x1.6fffffffffb78p6, 0x1.7016421c06043p6},
{0x1.0p1, 0x1.7p6, 0x1.7016421c064cbp6},
{0x1.0p1, 0x1.73fffffffffap6, 0x1.741604da8d2b9p6},
{0x1.0p1, 0x1.73ffffffffff8p6, 0x1.741604da8d311p6},
{0x1.0p1, 0x1.77ffffffffffp6, 0x1.7815c8e69cc37p6},
{0x1.0p1, 0x1.77ffffffffffcp6, 0x1.7815c8e69cc43p6},
{0x1.0p1, 0x1.7bfffffffffep6, 0x1.7c158e35adde4p6},
{0x1.0p1, 0x1.7bfffffffffe8p6, 0x1.7c158e35addecp6},
{0x1.0p1, 0x1.7ffffffffffffp6, 0x1.801554bda99c5p6},
{0x1.0p1, 0x1.83ffffffffdap6, 0x1.84151c74e35e4p6},
{0x1.0p1, 0x1.83ffffffffdep6, 0x1.84151c74e3625p6},
{0x1.0p1, 0x1.87fffffffffdp6, 0x1.8814e55214271p6},
{0x1.0p1, 0x1.87ffffffffffcp6, 0x1.8814e5521429ep6},
{0x1.0p1, 0x1.8bfffffffffep6, 0x1.8c14af4c540b6p6},
{0x1.0p1, 0x1.8bffffffffff6p6, 0x1.8c14af4c540cdp6},
{0x1.0p1, 0x1.8ffffffffffe8p6, 0x1.90147a5b16ce5p6},
{0x1.0p1, 0x1.8fffffffffffcp6, 0x1.90147a5b16cfap6},
{0x1.8p1, 0x1.ffffffffffffdp-1, 0x1.94c583ada5b53p1},
{0x1.8p1, 0x1.0p1, 0x1.cd82b446159f3p1},
{0x1.8p1, 0x1.7fffffffffff7p1, 0x1.0f876ccdf6cd6p2},
{0x1.8p1, 0x1.8p1, 0x1.0f876ccdf6cd9p2},
{0x1.8p1, 0x1.fffffffffffffp1, 0x1.4p2},
{0x1.8p1, 0x1.3ffffffffffe1p2, 0x1.752e50db3a387p2},
{0x1.8p1, 0x1.4p2, 0x1.752e50db3a3a2p2},
{0x1.8p1, 0x1.7ffffffffffffp2, 0x1.ad5336963eefap2},
{0x1.8p1, 0x1.bfffffffffffep2, 0x1.e768d399dc46dp2},
{0x1.8p1, 0x1.bffffffffffffp2, 0x1.e768d399dc46fp2},
{0x1.8p1, 0x1.fffffffffffffp2, 0x1.11687a8ae14a3p3},
{0x1.8p1, 0x1.1fffffffffff2p3, 0x1.2f9422c23c47p3},
{0x1.8p1, 0x1.1fffffffffff7p3, 0x1.2f9422c23c475p3},
{0x1.8p1, 0x1.3fffffffffff1p3, 0x1.4e16fdacff928p3},
{0x1.8p1, 0x1.3fffffffffff4p3, 0x1.4e16fdacff92bp3},
{0x1.8p1, 0x1.5ffffffffffffp3, 0x1.6cdb2bbb212ebp3},
{0x1.8p1, 0x1.7fffffffffffdp3, 0x1.8bd171a07e388p3},
{0x1.8p1, 0x1.7ffffffffffffp3, 0x1.8bd171a07e389p3},
{0x1.8p1, 0x1.9ffffffffffe4p3, 0x1.aaeee979b481cp3},
{0x1.8p1, 0x1.9ffffffffffecp3, 0x1.aaeee979b4825p3},
{0x1.8p1, 0x1.bffffffffffeep3, 0x1.ca2b9714180e5p3},
{0x1.8p1, 0x1.cp3, 0x1.ca2b9714180f7p3},
{0x1.8p1, 0x1.dfffffffffffcp3, 0x1.e98180e9b47edp3},
{0x1.8p1, 0x1.dfffffffffffep3, 0x1.e98180e9b47efp3},
{0x1.8p1, 0x1.fffffffffffffp3, 0x1.04760c95db31p4},
{0x1.8p1, 0x1.0fffffffffff4p4, 0x1.1433ec467efefp4},
{0x1.8p1, 0x1.1ffffffffffeap4, 0x1.23f8fc68ae515p4},
{0x1.8p1, 0x1.2p4, 0x1.23f8fc68ae52bp4},
{0x1.8p1, 0x1.2fffffffffffcp4, 0x1.33c42213ee0c5p4},
{0x1.8p1, 0x1.3p4, 0x1.33c42213ee0c9p4},
{0x1.8p1, 0x1.3ffffffffffd9p4, 0x1.439479381ec96p4},
{0x1.8p1, 0x1.3fffffffffff6p4, 0x1.439479381ecb3p4},
{0x1.8p1, 0x1.4ffffffffffc4p4, 0x1.53694801747d4p4},
{0x1.8p1, 0x1.4ffffffffffccp4, 0x1.53694801747dcp4},
{0x1.8p1, 0x1.5ffffffffffbep4, 0x1.6341f58bad9d2p4},
{0x1.8p1, 0x1.5ffffffffffc2p4, 0x1.6341f58bad9d7p4},
{0x1.8p1, 0x1.6fffffffffff8p4, 0x1.731e02ed21f18p4},
{0x1.8p1, 0x1.6ffffffffffffp4, 0x1.731e02ed21f2p4},
{0x1.8p1, 0x1.7fffffffffffdp4, 0x1.82fd05f129836p4},
{0x1.8p1, 0x1.7ffffffffffffp4, 0x1.82fd05f129837p4},
{0x1.8p1, 0x1.8ffffffffffa8p4, 0x1.92dea50d28578p4},
{0x1.8p1, 0x1.8ffffffffffffp4, 0x1.92dea50d285cep4},
{0x1.8p1, 0x1.9ffffffffffe4p4, 0x1.a2c2943e2866p4},
{0x1.8p1, 0x1.9fffffffffffcp4, 0x1.a2c2943e28678p4},
{0x1.8p1, 0x1.afffffffffff8p4, 0x1.b2a892946f42dp4},
{0x1.8p1, 0x1.afffffffffffep4, 0x1.b2a892946f434p4},
{0x1.8p1, 0x1.bffffffffffeep4, 0x1.c2906842b6bf3p4},
{0x1.8p1, 0x1.bfffffffffff2p4, 0x1.c2906842b6bf8p4},
{0x1.8p1, 0x1.cffffffffffe8p4, 0x1.d279e51208c72p4},
{0x1.8p1, 0x1.dp4, 0x1.d279e51208c8ap4},
{0x1.8p1, 0x1.dfffffffffff4p4, 0x1.e264df234beddp4},
{0x1.8p1, 0x1.dfffffffffffcp4, 0x1.e264df234bee4p4},
{0x1.8p1, 0x1.efffffffffff8p4, 0x1.f25131ed54d64p4},
{0x1.8p1, 0x1.fp4, 0x1.f25131ed54d6cp4},
{0x1.8p1, 0x1.fffffffffffffp4, 0x1.011f5eb54147p5},
{0x1.8p1, 0x1.07fffffffff88p5, 0x1.0916b2b5fff3ep5},
{0x1.8p1, 0x1.07fffffffffaap5, 0x1.0916b2b5fff6p5},
{0x1.8p1, 0x1.0ffffffffffc4p5, 0x1.110e8885865b8p5},
{0x1.8p1, 0x1.0ffffffffffccp5, 0x1.110e8885865c1p5},
{0x1.8p1, 0x1.17fffffffff58p5, 0x1.1906d51932b7ep5},
{0x1.8p1, 0x1.17fffffffff77p5, 0x1.1906d51932b9dp5},
{0x1.8p1, 0x1.1fffffffffffap5, 0x1.20ff8e9d967d6p5},
{0x1.8p1, 0x1.1fffffffffffep5, 0x1.20ff8e9d967dbp5},
{0x1.8p1, 0x1.27fffffffffc8p5, 0x1.28f8ac4cd98f2p5},
{0x1.8p1, 0x1.27fffffffffd8p5, 0x1.28f8ac4cd9903p5},
{0x1.8p1, 0x1.2ffffffffff7cp5, 0x1.30f2264b9c502p5},
{0x1.8p1, 0x1.2ffffffffffafp5, 0x1.30f2264b9c535p5},
{0x1.8p1, 0x1.37ffffffffff8p5, 0x1.38ebf58b30cb4p5},
{0x1.8p1, 0x1.37fffffffffffp5, 0x1.38ebf58b30cbcp5},
{0x1.8p1, 0x1.3fffffffffffdp5, 0x1.40e613b03f1dcp5},
{0x1.8p1, 0x1.3ffffffffffffp5, 0x1.40e613b03f1dfp5},
{0x1.8p1, 0x1.47fffffffffa1p5, 0x1.48e07afd169d5p5},
{0x1.8p1, 0x1.47fffffffffa8p5, 0x1.48e07afd169dbp5},
{0x1.8p1, 0x1.4ffffffffff84p5, 0x1.50db263f101e3p5},
{0x1.8p1, 0x1.4ffffffffff8cp5, 0x1.50db263f101ecp5},
{0x1.8p1, 0x1.57ffffffffff8p5, 0x1.58d610be831eep5},
{0x1.8p1, 0x1.58p5, 0x1.58d610be831f7p5},
{0x1.8p1, 0x1.5fffffffffffap5, 0x1.60d13630e611p5},
{0x1.8p1, 0x1.5fffffffffffep5, 0x1.60d13630e6113p5},
{0x1.8p1, 0x1.67fffffffffe8p5, 0x1.68cc92acc47abp5},
{0x1.8p1, 0x1.68p5, 0x1.68cc92acc47c3p5},
{0x1.8p1, 0x1.6fffffffffff8p5, 0x1.70c8229f43a38p5},
{0x1.8p1, 0x1.6fffffffffffap5, 0x1.70c8229f43a3ap5},
{0x1.8p1, 0x1.77ffffffffffp5, 0x1.78c3e2c2fb433p5},
{0x1.8p1, 0x1.77ffffffffffep5, 0x1.78c3e2c2fb441p5},
{0x1.8p1, 0x1.7ffffffffffffp5, 0x1.80bfd017f10a6p5},
{0x1.8p1, 0x1.87fffffffff5p5, 0x1.88bbe7dc8d9ap5},
{0x1.8p1, 0x1.88p5, 0x1.88bbe7dc8da5p5},
{0x1.8p1, 0x1.8ffffffffffe8p5, 0x1.90b8278768b67p5},
{0x1.8p1, 0x1.9p5, 0x1.90b8278768b8p5},
{0x1.8p1, 0x1.97fffffffff2bp5, 0x1.98b48cc1ce669p5},
{0x1.8p1, 0x1.97fffffffff3p5, 0x1.98b48cc1ce66dp5},
{0x1.8p1, 0x1.9ffffffffff34p5, 0x1.a0b11562e5efcp5},
{0x1.8p1, 0x1.ap5, 0x1.a0b11562e5fc8p5},
{0x1.8p1, 0x1.a7fffffffffdp5, 0x1.a8adbf6b63874p5},
{0x1.8p1, 0x1.a8p5, 0x1.a8adbf6b638a4p5},
{0x1.8p1, 0x1.affffffffffd8p5, 0x1.b0aa8901b442cp5},
{0x1.8p1, 0x1.affffffffffe8p5, 0x1.b0aa8901b443dp5},
{0x1.8p1, 0x1.b7ffffffffffp5, 0x1.b8a7706e94761p5},
{0x1.8p1, 0x1.b7ffffffffffep5, 0x1.b8a7706e9477p5},
{0x1.8p1, 0x1.bfffffffffffep5, 0x1.c0a4741a02dcap5},
{0x1.8p1, 0x1.cp5, 0x1.c0a4741a02dcdp5},
{0x1.8p1, 0x1.c7fffffffffdp5, 0x1.c8a1928885b75p5},
{0x1.8p1, 0x1.c7ffffffffff9p5, 0x1.c8a1928885b9fp5},
{0x1.8p1, 0x1.cffffffffff28p5, 0x1.d09eca58b7d2cp5},
{0x1.8p1, 0x1.dp5, 0x1.d09eca58b7e04p5},
{0x1.8p1, 0x1.d7ffffffffffp5, 0x1.d89c1a4115253p5},
{0x1.8p1, 0x1.d8p5, 0x1.d89c1a4115264p5},
{0x1.8p1, 0x1.dfffffffffffcp5, 0x1.e099810dfefd1p5},
{0x1.8p1, 0x1.e7fffffffffdp5, 0x1.e896fd9ff2afep5},
{0x1.8p1, 0x1.e7ffffffffffap5, 0x1.e896fd9ff2b29p5},
{0x1.8p1, 0x1.effffffffff98p5, 0x1.f0948ee9ebc7bp5},
{0x1.8p1, 0x1.effffffffffcap5, 0x1.f0948ee9ebcadp5},
{0x1.8p1, 0x1.f7fffffffff7p5, 0x1.f89233efeda08p5},
{0x1.8p1, 0x1.f7fffffffffb2p5, 0x1.f89233efeda4ap5},
{0x1.8p1, 0x1.ffffffffffda9p5, 0x1.0047f5e2d7ed7p6},
{0x1.8p1, 0x1.03ffffffffedp6, 0x1.0446dac6b5468p6},
{0x1.8p1, 0x1.04p6, 0x1.0446dac6b5598p6},
{0x1.8p1, 0x1.07fffffffffe8p6, 0x1.0845c83b5eb9bp6},
{0x1.8p1, 0x1.07ffffffffff9p6, 0x1.0845c83b5ebadp6},
{0x1.8p1, 0x1.0bffffffffe9bp6, 0x1.0c44bdded82bdp6},
{0x1.8p1, 0x1.0bffffffffebp6, 0x1.0c44bdded82d1p6},
{0x1.8p1, 0x1.0fffffffffed4p6, 0x1.1043bb54e5cc9p6},
{0x1.8p1, 0x1.0ffffffffff1fp6, 0x1.1043bb54e5d14p6},
{0x1.8p1, 0x1.13ffffffffe9p6, 0x1.1442c046a0ea6p6},
{0x1.8p1, 0x1.13fffffffff5ap6, 0x1.1442c046a0f7p6},
{0x1.8p1, 0x1.17fffffffffa8p6, 0x1.1841cc62174cbp6},
{0x1.8p1, 0x1.17fffffffffb8p6, 0x1.1841cc62174dap6},
{0x1.8p1, 0x1.1bffffffffffp6, 0x1.1c40df59f1a57p6},
{0x1.8p1, 0x1.1cp6, 0x1.1c40df59f1a67p6},
{0x1.8p1, 0x1.1fffffffffffap6, 0x1.203ff8e522535p6},
{0x1.8p1, 0x1.1ffffffffffffp6, 0x1.203ff8e52253bp6},
{0x1.8p1, 0x1.23fffffffffdp6, 0x1.243f18be9a334p6},
{0x1.8p1, 0x1.23ffffffffffbp6, 0x1.243f18be9a36p6},
{0x1.8p1, 0x1.27fffffffffe8p6, 0x1.283e3ea503c63p6},
{0x1.8p1, 0x1.27ffffffffff8p6, 0x1.283e3ea503c74p6},
{0x1.8p1, 0x1.2bffffffffdfp6, 0x1.2c3d6a5a83932p6},
{0x1.8p1, 0x1.2bffffffffe1p6, 0x1.2c3d6a5a83953p6},
{0x1.8p1, 0x1.2fffffffffffcp6, 0x1.303c9ba47e6d4p6},
{0x1.8p1, 0x1.3p6, 0x1.303c9ba47e6d8p6},
{0x1.8p1, 0x1.33fffffffffdp6, 0x1.343bd24b62468p6},
{0x1.8p1, 0x1.33fffffffffffp6, 0x1.343bd24b62498p6},
{0x1.8p1, 0x1.37ffffffffff8p6, 0x1.383b0e1a75c0ap6},
{0x1.8p1, 0x1.37fffffffffffp6, 0x1.383b0e1a75c12p6},
{0x1.8p1, 0x1.3bffffffffffp6, 0x1.3c3a4edfa9748p6},
{0x1.8p1, 0x1.3bffffffffffep6, 0x1.3c3a4edfa9756p6},
{0x1.8p1, 0x1.3fffffffffd4dp6, 0x1.4039946b6d79fp6},
{0x1.8p1, 0x1.3ffffffffffffp6, 0x1.4039946b6da51p6},
{0x1.8p1, 0x1.43fffffffff9p6, 0x1.4438de908abeap6},
{0x1.8p1, 0x1.43fffffffffbp6, 0x1.4438de908ac0bp6},
{0x1.8p1, 0x1.47ffffffffd08p6, 0x1.48382d23fccedp6},
{0x1.8p1, 0x1.47fffffffffa2p6, 0x1.48382d23fcf87p6},
{0x1.8p1, 0x1.4bffffffffcebp6, 0x1.4c377ffcd212fp6},
{0x1.8p1, 0x1.4bffffffffcfp6, 0x1.4c377ffcd2133p6},
{0x1.8p1, 0x1.4ffffffffff44p6, 0x1.5036d6f40ad53p6},
{0x1.8p1, 0x1.4ffffffffff9bp6, 0x1.5036d6f40adaap6},
{0x1.8p1, 0x1.53ffffffffedp6, 0x1.543631e47c1e1p6},
{0x1.8p1, 0x1.54p6, 0x1.543631e47c311p6},
{0x1.8p1, 0x1.57ffffffffd78p6, 0x1.583590aab542dp6},
{0x1.8p1, 0x1.58p6, 0x1.583590aab56b5p6},
{0x1.8p1, 0x1.5bffffffffc7p6, 0x1.5c34f324e60eep6},
{0x1.8p1, 0x1.5bffffffffc9p6, 0x1.5c34f324e610fp6},
{0x1.8p1, 0x1.5fffffffffffdp6, 0x1.60345932c760dp6},
{0x1.8p1, 0x1.5fffffffffffep6, 0x1.60345932c760dp6},
{0x1.8p1, 0x1.63fffffffff79p6, 0x1.6433c2b58421fp6},
{0x1.8p1, 0x1.63fffffffff9p6, 0x1.6433c2b584235p6},
{0x1.8p1, 0x1.67ffffffffda8p6, 0x1.68332f8fa63a6p6},
{0x1.8p1, 0x1.67fffffffff4dp6, 0x1.68332f8fa654bp6},
{0x1.8p1, 0x1.6bfffffffffep6, 0x1.6c329fa502ccfp6},
{0x1.8p1, 0x1.6cp6, 0x1.6c329fa502cefp6},
{0x1.8p1, 0x1.6fffffffffff8p6, 0x1.703212daa75f3p6},
{0x1.8p1, 0x1.6ffffffffffffp6, 0x1.703212daa75fbp6},
{0x1.8p1, 0x1.73fffffffffap6, 0x1.74318916ca409p6},
{0x1.8p1, 0x1.74p6, 0x1.74318916ca46ap6},
{0x1.8p1, 0x1.77ffffffffffp6, 0x1.78310240ba47p6},
{0x1.8p1, 0x1.78p6, 0x1.78310240ba481p6},
{0x1.8p1, 0x1.7bfffffffffep6, 0x1.7c307e40cff7fp6},
{0x1.8p1, 0x1.7bfffffffffe4p6, 0x1.7c307e40cff83p6},
{0x1.8p1, 0x1.7fffffffffff7p6, 0x1.802ffd005ff07p6},
{0x1.8p1, 0x1.7fffffffffff9p6, 0x1.802ffd005ff0ap6},
{0x1.8p1, 0x1.83fffffffffap6, 0x1.842f7e69adc1ep6},
{0x1.8p1, 0x1.83fffffffffffp6, 0x1.842f7e69adc7dp6},
{0x1.8p1, 0x1.87fffffffffdp6, 0x1.882f0267dfef4p6},
{0x1.8p1, 0x1.88p6, 0x1.882f0267dff24p6},
{0x1.8p1, 0x1.8bfffffffffep6, 0x1.8c2e88e6f449ap6},
{0x1.8p1, 0x1.8bffffffffff6p6, 0x1.8c2e88e6f44b1p6},
{0x1.8p1, 0x1.8ffffffffffe8p6, 0x1.902e11d3b5549p6},
{0x1.8p1, 0x1.8fffffffffffep6, 0x1.902e11d3b556p6},
// Test near decision points of the fdlibm algorithm
{0x1.0000000000001p501, 0x1.000000000000p501, 0x1.6a09e667f3bcdp501},
{0x1.0p501, 0x1.0p499, 0x1.07e0f66afed07p501},
{0x1.0p500, 0x1.0p450, 0x1.0p500},
{0x1.0000000000001p500, 0x1.0p450, 0x1.0000000000001p500},
{0x1.0p500, 0x1.0p440, 0x1.0p500},
{0x1.0000000000001p500, 0x1.0p440, 0x1.0000000000001p500},
{0x1.0p500, 0x1.0p439, 0x1.0p500},
{0x1.0000000000001p500, 0x1.0p439, 0x1.0000000000001p500},
{0x1.0p-450, 0x1.0p-500, 0x1.0p-450},
{0x1.0000000000001p-450, 0x1.0p-500, 0x1.0000000000001p-450},
{0x1.0p-450, 0x1.fffffffffffffp-499, 0x1.0p-450},
{0x1.0000000000001p-450, 0x1.fffffffffffffp-499, 0x1.0000000000001p-450},
{0x1.0p-450, 0x1.0p-500, 0x1.0p-450},
{0x1.0000000000001p-450, 0x1.0p-500, 0x1.0000000000001p-450},
{0x1.0p-450, 0x1.fffffffffffffp-499, 0x1.0p-450},
{0x1.0000000000001p-450, 0x1.fffffffffffffp-499, 0x1.0000000000001p-450},
{0x1.00000_ffff_0000p500, 0x1.fffffffffffffp499, 0x1.6a09f1b837ccfp500},
{0x1.00000_0000_0001p500, 0x1.fffffffffffffp499, 0x1.6a09e667f3bcdp500},
{0x1.00000_ffff_ffffp500, 0x1.fffffffffffffp499, 0x1.6a09f1b8431d3p500},
{0x1.00001_0000_0000p500, 0x1.fffffffffffffp499, 0x1.6a09f1b8431d5p500},
// 0x1.0p-1022 is MIN_NORMAL
{0x1.0000000000001p-1022, 0x1.0000000000001p-1022, 0x1.6a09e667f3bcep-1022},
{0x1.0000000000001p-1022, 0x1.0p-1022, 0x1.6a09e667f3bcdp-1022},
{0x1.0000000000001p-1022, 0x0.fffffffffffffp-1022, 0x1.6a09e667f3bcdp-1022},
{0x1.0000000000001p-1022, 0x0.0000000000001P-1022, 0x1.0000000000001p-1022},
{0x1.0000000000001p-1022, 0.0, 0x1.0000000000001p-1022},
{0x1.0000000000000p-1022, 0x0.fffffffffffffp-1022, 0x1.6a09e667f3bccp-1022},
{0x1.0000000000000p-1021, 0x0.fffffffffffffp-1022, 0x1.1e3779b97f4a8p-1021},
{0x1.0000000000000p-1020, 0x0.fffffffffffffp-1022, 0x1.07e0f66afed07p-1020},
// 0x0.0000000000001P-1022 is MIN_VALUE (smallest nonzero number)
{0x0.0000000000001p-1022, 0x0.0000000000001p-1022, 0x0.0000000000001p-1022},
{0x0.0000000000002p-1022, 0x0.0000000000001p-1022, 0x0.0000000000002p-1022},
{0x0.0000000000003p-1022, 0x0.0000000000002p-1022, 0x0.0000000000004p-1022},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{0x0.fffffffffffffp-1022, 0x0.0000000000001p-1022, 0x0.fffffffffffffp-1022},
{0x1.41fcfeeb2e246p+420, 0x1.8d4d41eacdeccp+420, 0x1.ff65325de5517p420},
};
for (double[] testCase: testCases)
failures += testHypotCase(testCase[0], testCase[1], testCase[2]);
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.hypot against transliteration port of hypot.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x = Tests.createRandomDouble(random);
double y = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold.
double increment_x = 2.0 * Math.ulp(x);
double increment_y = 2.0 * Math.ulp(y);
// Don't worry about x or y overflowing to infinity if their
// exponent is MAX_EXPONENT.
for (int i = 0; i < 200; i++, x += increment_x) {
for (int j = 0; j < 200; j++, y += increment_y) {
failures += testHypotCase(x, y, FdlibmTranslit.hypot(x, y));
}
}
return failures;
}
}

View file

@ -0,0 +1,139 @@
/*
* Copyright (c) 2003, 2023, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8304028
* @key randomness
* @summary Tests for StrictMath.IEEEremainder
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build IeeeRemainderTests
* @run main IeeeRemainderTests
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/IeeeRemainderTests.java test properties that
* should hold for any IEEEremainder implementation, including the
* FDLIBM-based one required for StrictMath.IEEEremainder. Therefore,
* the test cases in ../Math/IEEEremainderTests.java are run against
* both the Math and StrictMath versions of IEEEremainder. The role
* of this test is to verify that the FDLIBM IEEEremainder algorithm
* is being used by running golden file tests on values that may vary
* from one conforming IEEEremainder implementation to another.
*/
public class IeeeRemainderTests {
private IeeeRemainderTests(){}
public static void main(String... args) {
int failures = 0;
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing IEEEremainder incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.IEEEremainder against transliteration port of IEEEremainder.
*/
private static int testAgainstTranslit() {
int failures = 0;
// The exact special cases for infinity, NaN, zero,
// etc. inputs are checked in the Math tests.
// Test exotic NaN bit patterns
double[][] exoticNaNs = {
{Double.longBitsToDouble(0x7FF0_0000_0000_0001L), 0.0},
{0.0, Double.longBitsToDouble(0x7FF0_0000_0000_0001L)},
{Double.longBitsToDouble(0xFFF_00000_0000_0001L), 0.0},
{0.0, Double.longBitsToDouble(0xFFF0_0000_0000_0001L)},
{Double.longBitsToDouble(0x7FF_00000_7FFF_FFFFL), 0.0},
{0.0, Double.longBitsToDouble(0x7FF0_7FFF_0000_FFFFL)},
{Double.longBitsToDouble(0xFFF_00000_7FFF_FFFFL), 0.0},
{0.0, Double.longBitsToDouble(0xFFF0_7FFF_0000_FFFFL)},
};
for (double[] exoticNaN: exoticNaNs) {
failures += testIEEEremainderCase(exoticNaN[0], exoticNaN[1],
FdlibmTranslit.IEEEremainder(exoticNaN[0], exoticNaN[1]));
}
// Probe near decision points in the FDLIBM algorithm.
double[][] decisionPoints = {
{0x1.fffffp1022, 100.0},
{0x1.fffffp1022, 0x1.fffffp1022},
{2.0*0x1.0p-1022, 0x1.0p-1022},
{2.0*0x1.0p-1022, 0x1.0p-1023},
};
for (var decisionPoint : decisionPoints) {
double x = decisionPoint[0];
double p = decisionPoint[1];
double increment_x = Math.ulp(x);
double increment_p = Math.ulp(p);
x = x - 64*increment_x;
p = p - 64*increment_p;
for (int i = 0; i < 128; i++, x += increment_x) {
for (int j = 0; j < 126; j++, p += increment_p) {
failures += testIEEEremainderCase( x, p, FdlibmTranslit.IEEEremainder( x, p));
failures += testIEEEremainderCase(-x, p, FdlibmTranslit.IEEEremainder(-x, p));
failures += testIEEEremainderCase( x, -p, FdlibmTranslit.IEEEremainder( x, -p));
failures += testIEEEremainderCase(-x, -p, FdlibmTranslit.IEEEremainder(-x, -p));
}
}
}
// Check random values
for (int k = 0; k < 200; k++ ) {
double x = random.nextDouble();
double p = random.nextDouble();
failures += testIEEEremainderCase(x, p, FdlibmTranslit.IEEEremainder(x, p));
}
return failures;
}
private static int testIEEEremainderCase(double input1, double input2, double expected) {
int failures = 0;
failures += Tests.test("StrictMath.IEEEremainder(double)", input1, input2,
StrictMath::IEEEremainder, expected);
return failures;
}
}

View file

@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2024, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import jdk.test.lib.RandomFactory;
import java.util.function.DoubleUnaryOperator;
/*
* @test
* @bug 8302026
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build InverseTrigTests
* @run main InverseTrigTests
* @summary Tests for StrictMath.{asin, acos, atan}
*/
/**
* The tests in ../Math/InverseTrigTests.java test properties that
* should hold for any implementation of the inverse trig functions
* ason, acos, and atan, including the FDLIBM-based ones required by
* the StrictMath class. Therefore, the test cases in
* ../Math/InverseTrig.java are run against both the Math and
* StrictMath versions of the inverse trig methods. The role of this
* test is to verify that the FDLIBM algorithms are being used by
* running golden file tests on values that may vary from one
* conforming implementation of the hyperbolics to another.
*/
public class InverseTrigTests {
private InverseTrigTests(){}
public static void main(String... args) {
int failures = 0;
failures += testAgainstTranslitCommon();
failures += testAsin();
failures += testAcos();
failures += testAtan();
if (failures > 0) {
System.err.println("Testing the inverse trig functions incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
/**
* Bundle together groups of testing methods.
*/
private static enum InverseTrigTest {
ASIN(InverseTrigTests::testAsinCase, FdlibmTranslit::asin),
ACOS(InverseTrigTests::testAcosCase, FdlibmTranslit::acos),
ATAN(InverseTrigTests::testAtanCase, FdlibmTranslit::atan);
private DoubleDoubleToInt testCase;
private DoubleUnaryOperator transliteration;
InverseTrigTest(DoubleDoubleToInt testCase, DoubleUnaryOperator transliteration) {
this.testCase = testCase;
this.transliteration = transliteration;
}
public DoubleDoubleToInt testCase() {return testCase;}
public DoubleUnaryOperator transliteration() {return transliteration;}
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test against shared points of interest.
*/
private static int testAgainstTranslitCommon() {
int failures = 0;
double[] pointsOfInterest = {
Double.MIN_NORMAL,
1.0,
Tests.createRandomDouble(random),
};
for (var testMethods : InverseTrigTest.values()) {
for (double testPoint : pointsOfInterest) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, testMethods);
}
}
return failures;
}
/**
* Test StrictMath.asin against transliteration port of asin.
*/
private static int testAsin() {
int failures = 0;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0x1p-27,
-0x1p-27,
0.5,
-0.5,
0.975,
-0.975,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, InverseTrigTest.ASIN);
}
// Empirical worst-case points in other libraries with larger
// worst-case error than FDLIBM
double [][] testCases = {
{-0x1.00d44cccfa99p-1, -0x1.0d0a6a0e79e15p-1},
{-0x1.0239000439deep-1, -0x1.0ea71ea2a7cd7p-1},
{+0x1.0479b37d95e5cp-1, 0x1.1143fafdc5b2cp-1},
{-0x1.2ef2481799c7cp-1, -0x1.442d10aa50906p-1},
};
for (double[] testCase : testCases) {
failures += testAsinCase(testCase[0], testCase[1]);
}
return failures;
}
/**
* Test StrictMath.acos against transliteration port of acos.
*/
private static int testAcos() {
int failures = 0;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0.5,
-0.5,
0x1.0p-57,
-0x1.0p-57,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, InverseTrigTest.ACOS);
}
// Empirical worst-case points in other libraries with larger
// worst-case error than FDLIBM
double [][] testCases = {
{+0x1.35b03e336a82bp-1, 0x1.d7a84ec2f6707p-1},
{-0x1.8d313198a2e03p-53, 0x1.921fb54442d19p0},
{-0x1.010fd0ad6aa41p-1, 0x1.0c63a8cd23befp1},
{+0x1.251869c3f7881p-1, 0x1.ec2ff0c102684p-1},
{+0x1.266637a3d2bbcp-1, 0x1.ea98637533648p-1},
};
for (double[] testCase : testCases) {
failures += testAcosCase(testCase[0], testCase[1]);
}
return failures;
}
/**
* Test StrictMath.atan against transliteration port of atan
*/
private static int testAtan() {
int failures = 0;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0.0,
7.0/16.0,
11.0/16.0,
19.0/16.0,
39.0/16.0,
0x1.0p66,
0x1.0p-29,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, InverseTrigTest.ATAN);
}
// Empirical worst-case points in other libraries with larger
// worst-case error than FDLIBM
double [][] testCases = {
{+0x1.0103fc4ebaaa8p+1, 0x1.1bd5c375c97b5p0},
{+0x1.01e0be37af68fp+1, 0x1.1c2d45ec82765p0},
{-0x1.60370d15396b7p-1, -0x1.348461c347fd9p-1},
{+0x1.032b4811f3dc5p+0, 0x1.9545fd233ee14p-1},
{+0x1.52184b1b9bd9bp+0, 0x1.d86de33c93814p-1},
{-0x1.0684fa9fa7481p+0, -0x1.988f9da70b11ap-1},
};
for (double[] testCase : testCases) {
failures += testAtanCase(testCase[0], testCase[1]);
}
return failures;
}
private interface DoubleDoubleToInt {
int apply(double x, double y);
}
private static int testRange(double start, double increment, int count,
InverseTrigTest testMethods) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures +=
testMethods.testCase().apply(x, testMethods.transliteration().applyAsDouble(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count,
InverseTrigTest testMethods) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures +=
testMethods.testCase().apply(x, testMethods.transliteration().applyAsDouble(x));
}
return failures;
}
private static int testAsinCase(double input, double expected) {
return Tests.test("StrictMath.asin(double)", input,
StrictMath::asin, expected);
}
private static int testAcosCase(double input, double expected) {
return Tests.test("StrictMath.acos(double)", input,
StrictMath::acos, expected);
}
private static int testAtanCase(double input, double expected) {
return Tests.test("StrictMath.atan(double)", input,
StrictMath::atan, expected);
}
}

View file

@ -0,0 +1,785 @@
/*
* Copyright (c) 2003, 2025, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4074599 8301205
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build Log10Tests
* @run main Log10Tests
* @summary Tests for StrictMath.log10
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/Log10Tests.java test properties that should
* hold for any log10 implementation, including the FDLIBM-based one
* required for StrictMath.log10. Therefore, the test cases in
* ../Math/Log10Tests.java are run against both the Math and
* StrictMath versions of log10. The role of this test is to verify
* that the FDLIBM log10 algorithm is being used by running golden
* file tests on values that may vary from one conforming log10
* implementation to another.
*/
public class Log10Tests {
private Log10Tests(){}
public static void main(String... args) {
int failures = 0;
failures += testLog10();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing log10 incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
static int testLog10Case(double input, double expected) {
return Tests.test("StrictMath.log10(double)", input,
StrictMath::log10, expected);
}
static int testLog10() {
int failures = 0;
double [][] testCases = {
{0x1.3fffffffffec1p-297, -0x1.653c6a27ae2f8p6},
{0x1.4p-297, -0x1.653c6a27ae2f7p6},
{0x1.3fffffffffbe1p-296, -0x1.640828f2a4382p6},
{0x1.4p-296, -0x1.640828f2a437dp6},
{0x1.3fffffffffd52p-295, -0x1.62d3e7bd9a406p6},
{0x1.4p-295, -0x1.62d3e7bd9a403p6},
{0x1.3fffffffffa72p-294, -0x1.619fa6889049p6},
{0x1.4p-294, -0x1.619fa68890489p6},
{0x1.3fffffffff9bbp-293, -0x1.606b655386518p6},
{0x1.4p-293, -0x1.606b65538650fp6},
{0x1.3fffffffffbe4p-292, -0x1.5f37241e7c59ap6},
{0x1.4p-292, -0x1.5f37241e7c595p6},
{0x1.3ffffffffff7ep-291, -0x1.5e02e2e97261cp6},
{0x1.4p-291, -0x1.5e02e2e97261bp6},
{0x1.3fffffffffc9ep-290, -0x1.5ccea1b4686a6p6},
{0x1.4p-290, -0x1.5ccea1b4686a1p6},
{0x1.3fffffffffec7p-289, -0x1.5b9a607f5e728p6},
{0x1.4p-289, -0x1.5b9a607f5e727p6},
{0x1.3fffffffffbe7p-288, -0x1.5a661f4a547b2p6},
{0x1.4p-288, -0x1.5a661f4a547adp6},
{0x1.3fffffffff907p-287, -0x1.5931de154a83cp6},
{0x1.4p-287, -0x1.5931de154a833p6},
{0x1.3fffffffffd59p-286, -0x1.57fd9ce0408bcp6},
{0x1.4p-286, -0x1.57fd9ce0408b9p6},
{0x1.3fffffffffecap-285, -0x1.56c95bab3694p6},
{0x1.4p-285, -0x1.56c95bab3693fp6},
{0x1.3fffffffffbeap-284, -0x1.55951a762c9cap6},
{0x1.4p-284, -0x1.55951a762c9c5p6},
{0x1.3ffffffffff84p-283, -0x1.5460d94122a4cp6},
{0x1.4p-283, -0x1.5460d94122a4bp6},
{0x1.3fffffffffca4p-282, -0x1.532c980c18ad6p6},
{0x1.4p-282, -0x1.532c980c18ad1p6},
{0x1.3fffffffff9c4p-281, -0x1.51f856d70eb6p6},
{0x1.4p-281, -0x1.51f856d70eb57p6},
{0x1.3fffffffffe16p-280, -0x1.50c415a204bep6},
{0x1.4p-280, -0x1.50c415a204bddp6},
{0x1.3fffffffffd5ep-279, -0x1.4f8fd46cfac66p6},
{0x1.4p-279, -0x1.4f8fd46cfac63p6},
{0x1.3fffffffffd5fp-278, -0x1.4e5b9337f0cecp6},
{0x1.4p-278, -0x1.4e5b9337f0ce9p6},
{0x1.3fffffffffedp-277, -0x1.4d275202e6d7p6},
{0x1.4p-277, -0x1.4d275202e6d6fp6},
{0x1.3fffffffffbfp-276, -0x1.4bf310cddcdfap6},
{0x1.4p-276, -0x1.4bf310cddcdf5p6},
{0x1.3ffffffffff8ap-275, -0x1.4abecf98d2e7bp6},
{0x1.4p-275, -0x1.4abecf98d2e7bp6},
{0x1.3fffffffffd62p-274, -0x1.498a8e63c8f04p6},
{0x1.4p-274, -0x1.498a8e63c8f01p6},
{0x1.3fffffffff9cap-273, -0x1.48564d2ebef9p6},
{0x1.4p-273, -0x1.48564d2ebef87p6},
{0x1.3fffffffff6eap-272, -0x1.47220bf9b501ap6},
{0x1.4p-272, -0x1.47220bf9b500dp6},
{0x1.3fffffffffb3cp-271, -0x1.45edcac4ab09ap6},
{0x1.4p-271, -0x1.45edcac4ab093p6},
{0x1.3fffffffffd65p-270, -0x1.44b9898fa111cp6},
{0x1.4p-270, -0x1.44b9898fa1119p6},
{0x1.3fffffffffa85p-269, -0x1.4385485a971a6p6},
{0x1.4p-269, -0x1.4385485a9719fp6},
{0x1.3ffffffffe2c7p-268, -0x1.425107258d24dp6},
{0x1.3fffffffffed7p-268, -0x1.425107258d226p6},
{0x1.4p-268, -0x1.425107258d225p6},
{0x1.3fffffffff916p-267, -0x1.411cc5f0832b4p6},
{0x1.4p-267, -0x1.411cc5f0832abp6},
{0x1.3fffffffffd68p-266, -0x1.3fe884bb79334p6},
{0x1.4p-266, -0x1.3fe884bb79331p6},
{0x1.3fffffffffe21p-265, -0x1.3eb443866f3b9p6},
{0x1.4p-265, -0x1.3eb443866f3b7p6},
{0x1.3fffffffffedap-264, -0x1.3d8002516543ep6},
{0x1.4p-264, -0x1.3d8002516543dp6},
{0x1.3fffffffffbfap-263, -0x1.3c4bc11c5b4c9p6},
{0x1.4p-263, -0x1.3c4bc11c5b4c3p6},
{0x1.3fffffffff862p-262, -0x1.3b177fe751554p6},
{0x1.4p-262, -0x1.3b177fe751549p6},
{0x1.3fffffffffa8bp-261, -0x1.39e33eb2475d6p6},
{0x1.4p-261, -0x1.39e33eb2475cfp6},
{0x1.3fffffffffeddp-260, -0x1.38aefd7d3d656p6},
{0x1.4p-260, -0x1.38aefd7d3d655p6},
{0x1.3fffffffffbfdp-259, -0x1.377abc48336ep6},
{0x1.4p-259, -0x1.377abc48336dbp6},
{0x1.3ffffffffff97p-258, -0x1.36467b1329762p6},
{0x1.4p-258, -0x1.36467b1329761p6},
{0x1.3fffffffffedfp-257, -0x1.351239de1f7e8p6},
{0x1.4p-257, -0x1.351239de1f7e7p6},
{0x1.3fffffffffeep-256, -0x1.33ddf8a91586ep6},
{0x1.4p-256, -0x1.33ddf8a91586dp6},
{0x1.3fffffffffcp-255, -0x1.32a9b7740b8f8p6},
{0x1.4p-255, -0x1.32a9b7740b8f3p6},
{0x1.3fffffffffd71p-254, -0x1.3175763f0197cp6},
{0x1.4p-254, -0x1.3175763f01979p6},
{0x1.3fffffffff588p-253, -0x1.30413509f7a0ep6},
{0x1.4p-253, -0x1.30413509f79ffp6},
{0x1.3fffffffff7b1p-252, -0x1.2f0cf3d4eda9p6},
{0x1.4p-252, -0x1.2f0cf3d4eda85p6},
{0x1.3fffffffffc03p-251, -0x1.2dd8b29fe3b1p6},
{0x1.4p-251, -0x1.2dd8b29fe3b0bp6},
{0x1.3fffffffff86bp-250, -0x1.2ca4716ad9b9cp6},
{0x1.4p-250, -0x1.2ca4716ad9b91p6},
{0x1.3fffffffffcbdp-249, -0x1.2b703035cfc1cp6},
{0x1.4p-249, -0x1.2b703035cfc17p6},
{0x1.3fffffffffee6p-248, -0x1.2a3bef00c5c9ep6},
{0x1.4p-248, -0x1.2a3bef00c5c9dp6},
{0x1.3fffffffffc06p-247, -0x1.2907adcbbbd28p6},
{0x1.4p-247, -0x1.2907adcbbbd23p6},
{0x1.3fffffffffd77p-246, -0x1.27d36c96b1dacp6},
{0x1.4p-246, -0x1.27d36c96b1da9p6},
{0x1.3fffffffffd78p-245, -0x1.269f2b61a7e32p6},
{0x1.4p-245, -0x1.269f2b61a7e2fp6},
{0x1.3ffffffffea0bp-244, -0x1.256aea2c9ded3p6},
{0x1.3fffffffffee9p-244, -0x1.256aea2c9deb6p6},
{0x1.4p-244, -0x1.256aea2c9deb5p6},
{0x1.3fffffffffe32p-243, -0x1.2436a8f793f3ep6},
{0x1.4p-243, -0x1.2436a8f793f3bp6},
{0x1.3ffffffffffa3p-242, -0x1.230267c289fc2p6},
{0x1.4p-242, -0x1.230267c289fc1p6},
{0x1.3fffffffff591p-241, -0x1.21ce268d80056p6},
{0x1.4p-241, -0x1.21ce268d80047p6},
{0x1.3fffffffff9e3p-240, -0x1.2099e558760d6p6},
{0x1.4p-240, -0x1.2099e558760cdp6},
{0x1.3fffffffffc0cp-239, -0x1.1f65a4236c158p6},
{0x1.4p-239, -0x1.1f65a4236c153p6},
{0x1.3fffffffffd7dp-238, -0x1.1e3162ee621dcp6},
{0x1.4p-238, -0x1.1e3162ee621d9p6},
{0x1.3fffffffffd7ep-237, -0x1.1cfd21b958262p6},
{0x1.4p-237, -0x1.1cfd21b95825fp6},
{0x1.3fffffffffeefp-236, -0x1.1bc8e0844e2e6p6},
{0x1.4p-236, -0x1.1bc8e0844e2e5p6},
{0x1.3fffffffffc0fp-235, -0x1.1a949f4f4437p6},
{0x1.4p-235, -0x1.1a949f4f4436bp6},
{0x1.3ffffffffffa9p-234, -0x1.19605e1a3a3f1p6},
{0x1.4p-234, -0x1.19605e1a3a3f1p6},
{0x1.3ffffffffffaap-233, -0x1.182c1ce530478p6},
{0x1.4p-233, -0x1.182c1ce530477p6},
{0x1.3fffffffff2b7p-232, -0x1.16f7dbb02651p6},
{0x1.4p-232, -0x1.16f7dbb0264fdp6},
{0x1.3fffffffffef3p-231, -0x1.15c39a7b1c584p6},
{0x1.4p-231, -0x1.15c39a7b1c583p6},
{0x1.3fffffffff932p-230, -0x1.148f594612612p6},
{0x1.4p-230, -0x1.148f594612609p6},
{0x1.3fffffffffd84p-229, -0x1.135b181108692p6},
{0x1.4p-229, -0x1.135b18110868fp6},
{0x1.3fffffffffaa4p-228, -0x1.1226d6dbfe71cp6},
{0x1.4p-228, -0x1.1226d6dbfe715p6},
{0x1.3fffffffffef6p-227, -0x1.10f295a6f479cp6},
{0x1.4p-227, -0x1.10f295a6f479bp6},
{0x1.3fffffffffd86p-226, -0x1.0fbe5471ea824p6},
{0x1.4p-226, -0x1.0fbe5471ea821p6},
{0x1.3fffffffffd87p-225, -0x1.0e8a133ce08aap6},
{0x1.4p-225, -0x1.0e8a133ce08a7p6},
{0x1.3fffffffffef8p-224, -0x1.0d55d207d692ep6},
{0x1.4p-224, -0x1.0d55d207d692dp6},
{0x1.3fffffffffef9p-223, -0x1.0c2190d2cc9b4p6},
{0x1.4p-223, -0x1.0c2190d2cc9b3p6},
{0x1.3fffffffff42fp-222, -0x1.0aed4f9dc2a4ap6},
{0x1.4p-222, -0x1.0aed4f9dc2a39p6},
{0x1.3fffffffff658p-221, -0x1.09b90e68b8accp6},
{0x1.4p-221, -0x1.09b90e68b8abfp6},
{0x1.3fffffffffaaap-220, -0x1.0884cd33aeb4cp6},
{0x1.4p-220, -0x1.0884cd33aeb45p6},
{0x1.3fffffffffefcp-219, -0x1.07508bfea4bccp6},
{0x1.4p-219, -0x1.07508bfea4bcbp6},
{0x1.3fffffffffc1cp-218, -0x1.061c4ac99ac56p6},
{0x1.4p-218, -0x1.061c4ac99ac51p6},
{0x1.3fffffffffd8dp-217, -0x1.04e8099490cdap6},
{0x1.4p-217, -0x1.04e8099490cd7p6},
{0x1.3fffffffffaadp-216, -0x1.03b3c85f86d65p6},
{0x1.3fffffffffefep-216, -0x1.03b3c85f86d5ep6},
{0x1.4p-216, -0x1.03b3c85f86d5dp6},
{0x1.3ffffffffdbbdp-215, -0x1.027f872a7ce16p6},
{0x1.3fffffffffeffp-215, -0x1.027f872a7cde4p6},
{0x1.4p-215, -0x1.027f872a7cde3p6},
{0x1.3fffffffffc1fp-214, -0x1.014b45f572e6ep6},
{0x1.4p-214, -0x1.014b45f572e69p6},
{0x1.3ffffffffffb9p-213, -0x1.001704c068efp6},
{0x1.4p-213, -0x1.001704c068eefp6},
{0x1.3fffffffffdbfp-212, -0x1.fdc58716bdefp5},
{0x1.4p-212, -0x1.fdc58716bdeeap5},
{0x1.3ffffffffff3p-211, -0x1.fb5d04aca9ff8p5},
{0x1.4p-211, -0x1.fb5d04aca9ff6p5},
{0x1.3ffffffffffe9p-210, -0x1.f8f4824296102p5},
{0x1.4p-210, -0x1.f8f4824296102p5},
{0x1.3fffffffffd09p-209, -0x1.f68bffd882216p5},
{0x1.4p-209, -0x1.f68bffd88220ep5},
{0x1.3fffffffffdc2p-208, -0x1.f4237d6e6e32p5},
{0x1.4p-208, -0x1.f4237d6e6e31ap5},
{0x1.3fffffffff23fp-207, -0x1.f1bafb045a44cp5},
{0x1.3fffffffffe7bp-207, -0x1.f1bafb045a42ap5},
{0x1.4p-207, -0x1.f1bafb045a426p5},
{0x1.3ffffffffffecp-206, -0x1.ef52789a46532p5},
{0x1.4p-206, -0x1.ef52789a46532p5},
{0x1.3fffffffffdc4p-205, -0x1.ece9f63032644p5},
{0x1.4p-205, -0x1.ece9f6303263ep5},
{0x1.3ffffffffe211p-204, -0x1.ea8173c61e79ep5},
{0x1.3ffffffffff35p-204, -0x1.ea8173c61e74cp5},
{0x1.4p-204, -0x1.ea8173c61e74ap5},
{0x1.3ffffffffec25p-203, -0x1.e818f15c0a88ep5},
{0x1.3fffffffffe7ep-203, -0x1.e818f15c0a85ap5},
{0x1.4p-203, -0x1.e818f15c0a856p5},
{0x1.3ffffffffdcadp-202, -0x1.e5b06ef1f69c5p5},
{0x1.3fffffffffedbp-202, -0x1.e5b06ef1f6966p5},
{0x1.4p-202, -0x1.e5b06ef1f6962p5},
{0x1.3fffffffffd0fp-201, -0x1.e347ec87e2a76p5},
{0x1.4p-201, -0x1.e347ec87e2a6ep5},
{0x1.3fffffffffe8p-200, -0x1.e0df6a1dceb7ep5},
{0x1.4p-200, -0x1.e0df6a1dceb7ap5},
{0x1.3ffffffffff39p-199, -0x1.de76e7b3bac88p5},
{0x1.4p-199, -0x1.de76e7b3bac86p5},
{0x1.3fffffffffff2p-198, -0x1.dc0e6549a6d92p5},
{0x1.4p-198, -0x1.dc0e6549a6d92p5},
{0x1.3ffffffffff97p-197, -0x1.d9a5e2df92eap5},
{0x1.4p-197, -0x1.d9a5e2df92e9ep5},
{0x1.3fffffffffdcbp-196, -0x1.d73d60757efbp5},
{0x1.4p-196, -0x1.d73d60757efaap5},
{0x1.3ffffffffff3cp-195, -0x1.d4d4de0b6b0b8p5},
{0x1.4p-195, -0x1.d4d4de0b6b0b6p5},
{0x1.3fffffffffee1p-194, -0x1.d26c5ba1571c6p5},
{0x1.4p-194, -0x1.d26c5ba1571c2p5},
{0x1.3ffffffffff9ap-193, -0x1.d003d937432dp5},
{0x1.4p-193, -0x1.d003d937432cep5},
{0x1.3fffffffffdcep-192, -0x1.cd9b56cd2f3ep5},
{0x1.4p-192, -0x1.cd9b56cd2f3dap5},
{0x1.3fffffffffe87p-191, -0x1.cb32d4631b4eap5},
{0x1.4p-191, -0x1.cb32d4631b4e6p5},
{0x1.3fffffffffff8p-190, -0x1.c8ca51f9075f2p5},
{0x1.4p-190, -0x1.c8ca51f9075f2p5},
{0x1.3fffffffffff9p-189, -0x1.c661cf8ef36fep5},
{0x1.4p-189, -0x1.c661cf8ef36fep5},
{0x1.3fffffffffdd1p-188, -0x1.c3f94d24df81p5},
{0x1.4p-188, -0x1.c3f94d24df80ap5},
{0x1.3fffffffffe8ap-187, -0x1.c190cabacb91ap5},
{0x1.4p-187, -0x1.c190cabacb916p5},
{0x1.3ffffffffff43p-186, -0x1.bf284850b7a24p5},
{0x1.4p-186, -0x1.bf284850b7a22p5},
{0x1.3fffffffffffcp-185, -0x1.bcbfc5e6a3b2ep5},
{0x1.4p-185, -0x1.bcbfc5e6a3b2ep5},
{0x1.3ffffffffffa1p-184, -0x1.ba57437c8fc3cp5},
{0x1.4p-184, -0x1.ba57437c8fc3ap5},
{0x1.3fffffffffd79p-183, -0x1.b7eec1127bd4ep5},
{0x1.4p-183, -0x1.b7eec1127bd46p5},
{0x1.3fffffffffe32p-182, -0x1.b5863ea867e58p5},
{0x1.4p-182, -0x1.b5863ea867e52p5},
{0x1.3ffffffffe4a7p-181, -0x1.b31dbc3e53faap5},
{0x1.3ffffffffffffp-181, -0x1.b31dbc3e53f5ep5},
{0x1.4p-181, -0x1.b31dbc3e53f5ep5},
{0x1.3fffffffffdd7p-180, -0x1.b0b539d44007p5},
{0x1.4p-180, -0x1.b0b539d44006ap5},
{0x1.3fffffffffa9bp-179, -0x1.ae4cb76a2c185p5},
{0x1.3fffffffffe9p-179, -0x1.ae4cb76a2c17ap5},
{0x1.4p-179, -0x1.ae4cb76a2c177p5},
{0x1.3ffffffffe3f1p-178, -0x1.abe43500182d1p5},
{0x1.3ffffffffff49p-178, -0x1.abe4350018284p5},
{0x1.4p-178, -0x1.abe4350018283p5},
{0x1.3fffffffffc69p-177, -0x1.a97bb29604398p5},
{0x1.4p-177, -0x1.a97bb2960438fp5},
{0x1.3fffffffffddap-176, -0x1.a713302bf04ap5},
{0x1.4p-176, -0x1.a713302bf049bp5},
{0x1.3fffffffffe93p-175, -0x1.a4aaadc1dc5aap5},
{0x1.4p-175, -0x1.a4aaadc1dc5a7p5},
{0x1.3fffffffff481p-174, -0x1.a2422b57c86d3p5},
{0x1.3fffffffffe38p-174, -0x1.a2422b57c86b8p5},
{0x1.4p-174, -0x1.a2422b57c86b3p5},
{0x1.3fffffffffef1p-173, -0x1.9fd9a8edb47c2p5},
{0x1.4p-173, -0x1.9fd9a8edb47bfp5},
{0x1.3ffffffffffaap-172, -0x1.9d712683a08ccp5},
{0x1.4p-172, -0x1.9d712683a08cbp5},
{0x1.3fffffffffddep-171, -0x1.9b08a4198c9dcp5},
{0x1.4p-171, -0x1.9b08a4198c9d7p5},
{0x1.3ffffffffff4fp-170, -0x1.98a021af78ae4p5},
{0x1.4p-170, -0x1.98a021af78ae3p5},
{0x1.3fffffffffd27p-169, -0x1.96379f4564bf6p5},
{0x1.4p-169, -0x1.96379f4564befp5},
{0x1.3fffffffffdep-168, -0x1.93cf1cdb50dp5},
{0x1.4p-168, -0x1.93cf1cdb50cfbp5},
{0x1.3fffffffffe99p-167, -0x1.91669a713ce0ap5},
{0x1.4p-167, -0x1.91669a713ce07p5},
{0x1.3ffffffffff52p-166, -0x1.8efe180728f14p5},
{0x1.4p-166, -0x1.8efe180728f13p5},
{0x1.3fffffffffc72p-165, -0x1.8c95959d15028p5},
{0x1.4p-165, -0x1.8c95959d1501fp5},
{0x1.3ffffffffffbp-164, -0x1.8a2d13330112cp5},
{0x1.4p-164, -0x1.8a2d13330112bp5},
{0x1.3fffffffffd88p-163, -0x1.87c490c8ed23ep5},
{0x1.4p-163, -0x1.87c490c8ed237p5},
{0x1.3fffffffffe9dp-162, -0x1.855c0e5ed9346p5},
{0x1.4p-162, -0x1.855c0e5ed9343p5},
{0x1.3fffffffffefap-161, -0x1.82f38bf4c5452p5},
{0x1.4p-161, -0x1.82f38bf4c544fp5},
{0x1.3fffffffffd2ep-160, -0x1.808b098ab1562p5},
{0x1.4p-160, -0x1.808b098ab155bp5},
{0x1.3fffffffffe9fp-159, -0x1.7e2287209d66ap5},
{0x1.4p-159, -0x1.7e2287209d667p5},
{0x1.3ffffffffff58p-158, -0x1.7bba04b689774p5},
{0x1.4p-158, -0x1.7bba04b689773p5},
{0x1.3fffffffff099p-157, -0x1.7951824c758aap5},
{0x1.3ffffffffff59p-157, -0x1.7951824c7588p5},
{0x1.4p-157, -0x1.7951824c7587fp5},
{0x1.3fffffffffd31p-156, -0x1.76e8ffe261992p5},
{0x1.4p-156, -0x1.76e8ffe26198bp5},
{0x1.3fffffffffdeap-155, -0x1.74807d784da9cp5},
{0x1.4p-155, -0x1.74807d784da97p5},
{0x1.3fffffffffea3p-154, -0x1.7217fb0e39ba6p5},
{0x1.4p-154, -0x1.7217fb0e39ba3p5},
{0x1.3fffffffffc7bp-153, -0x1.6faf78a425cb8p5},
{0x1.3ffffffffff5cp-153, -0x1.6faf78a425cbp5},
{0x1.4p-153, -0x1.6faf78a425cafp5},
{0x1.3ffffffffffb9p-152, -0x1.6d46f63a11dbcp5},
{0x1.4p-152, -0x1.6d46f63a11dbbp5},
{0x1.3fffffffffa54p-151, -0x1.6ade73cffded6p5},
{0x1.4p-151, -0x1.6ade73cffdec7p5},
{0x1.3fffffffffbc5p-150, -0x1.6875f165e9fdfp5},
{0x1.3fffffffffea6p-150, -0x1.6875f165e9fd6p5},
{0x1.4p-150, -0x1.6875f165e9fd3p5},
{0x1.3ffffffffff5fp-149, -0x1.660d6efbd60ep5},
{0x1.4p-149, -0x1.660d6efbd60dfp5},
{0x1.3fffffffffdefp-148, -0x1.63a4ec91c21fp5},
{0x1.4p-148, -0x1.63a4ec91c21ebp5},
{0x1.3fffffffffea8p-147, -0x1.613c6a27ae2fap5},
{0x1.4p-147, -0x1.613c6a27ae2f7p5},
{0x1.3ffffffffff61p-146, -0x1.5ed3e7bd9a404p5},
{0x1.4p-146, -0x1.5ed3e7bd9a403p5},
{0x1.3ffffffffff62p-145, -0x1.5c6b65538651p5},
{0x1.4p-145, -0x1.5c6b65538650fp5},
{0x1.3ffffffffffbfp-144, -0x1.5a02e2e97261cp5},
{0x1.4p-144, -0x1.5a02e2e97261bp5},
{0x1.3fffffffffcdfp-143, -0x1.579a607f5e73p5},
{0x1.4p-143, -0x1.579a607f5e727p5},
{0x1.3fffffffffd98p-142, -0x1.5531de154a83ap5},
{0x1.4p-142, -0x1.5531de154a833p5},
{0x1.3fffffffffe51p-141, -0x1.52c95bab36944p5},
{0x1.4p-141, -0x1.52c95bab3693fp5},
{0x1.3ffffffffffc2p-140, -0x1.5060d94122a4cp5},
{0x1.4p-140, -0x1.5060d94122a4bp5},
{0x1.3fffffffffdf6p-139, -0x1.4df856d70eb5cp5},
{0x1.4p-139, -0x1.4df856d70eb57p5},
{0x1.3fffffffffeafp-138, -0x1.4b8fd46cfac66p5},
{0x1.4p-138, -0x1.4b8fd46cfac63p5},
{0x1.3ffffffffff68p-137, -0x1.49275202e6d7p5},
{0x1.4p-137, -0x1.49275202e6d6fp5},
{0x1.3ffffffffffc5p-136, -0x1.46becf98d2e7bp5},
{0x1.4p-136, -0x1.46becf98d2e7bp5},
{0x1.3fffffffffdf9p-135, -0x1.44564d2ebef8cp5},
{0x1.4p-135, -0x1.44564d2ebef87p5},
{0x1.3fffffffffeb2p-134, -0x1.41edcac4ab096p5},
{0x1.4p-134, -0x1.41edcac4ab093p5},
{0x1.3ffffffffff6bp-133, -0x1.3f85485a971ap5},
{0x1.4p-133, -0x1.3f85485a9719fp5},
{0x1.3ffffffffe699p-132, -0x1.3d1cc5f0832f2p5},
{0x1.3ffffffffff1p-132, -0x1.3d1cc5f0832aep5},
{0x1.4p-132, -0x1.3d1cc5f0832abp5},
{0x1.3ffffffffffc9p-131, -0x1.3ab443866f3b8p5},
{0x1.4p-131, -0x1.3ab443866f3b7p5},
{0x1.3fffffffffda1p-130, -0x1.384bc11c5b4cap5},
{0x1.4p-130, -0x1.384bc11c5b4c3p5},
{0x1.3ffffffffed15p-129, -0x1.35e33eb247604p5},
{0x1.3ffffffffff6ep-129, -0x1.35e33eb2475dp5},
{0x1.4p-129, -0x1.35e33eb2475cfp5},
{0x1.3ffffffffdd9dp-128, -0x1.337abc483373bp5},
{0x1.3fffffffffd46p-128, -0x1.337abc48336e2p5},
{0x1.4p-128, -0x1.337abc48336dbp5},
{0x1.3fffffffffdffp-127, -0x1.311239de1f7ecp5},
{0x1.4p-127, -0x1.311239de1f7e7p5},
{0x1.3fffffffff391p-126, -0x1.2ea9b7740b916p5},
{0x1.3ffffffffff7p-126, -0x1.2ea9b7740b8f4p5},
{0x1.4p-126, -0x1.2ea9b7740b8f3p5},
{0x1.3ffffffffff71p-125, -0x1.2c413509f7ap5},
{0x1.4p-125, -0x1.2c413509f79ffp5},
{0x1.3fffffffffc91p-124, -0x1.29d8b29fe3b14p5},
{0x1.4p-124, -0x1.29d8b29fe3b0bp5},
{0x1.3fffffffffd4ap-123, -0x1.27703035cfc1ep5},
{0x1.4p-123, -0x1.27703035cfc17p5},
{0x1.3fffffffffe03p-122, -0x1.2507adcbbbd28p5},
{0x1.4p-122, -0x1.2507adcbbbd23p5},
{0x1.3fffffffffebcp-121, -0x1.229f2b61a7e32p5},
{0x1.4p-121, -0x1.229f2b61a7e2fp5},
{0x1.3ffffffffff19p-120, -0x1.2036a8f793f3ep5},
{0x1.4p-120, -0x1.2036a8f793f3bp5},
{0x1.3fffffffffd4dp-119, -0x1.1dce268d8004ep5},
{0x1.4p-119, -0x1.1dce268d80047p5},
{0x1.3fffffffffebep-118, -0x1.1b65a4236c156p5},
{0x1.4p-118, -0x1.1b65a4236c153p5},
{0x1.3ffffffffff77p-117, -0x1.18fd21b95826p5},
{0x1.4p-117, -0x1.18fd21b95825fp5},
{0x1.3ffffffffffd4p-116, -0x1.16949f4f4436bp5},
{0x1.4p-116, -0x1.16949f4f4436bp5},
{0x1.3fffffffffe08p-115, -0x1.142c1ce53047cp5},
{0x1.4p-115, -0x1.142c1ce530477p5},
{0x1.3fffffffffe09p-114, -0x1.11c39a7b1c588p5},
{0x1.4p-114, -0x1.11c39a7b1c583p5},
{0x1.3fffffffffec2p-113, -0x1.0f5b181108692p5},
{0x1.4p-113, -0x1.0f5b18110868fp5},
{0x1.3ffffffffff7bp-112, -0x1.0cf295a6f479cp5},
{0x1.4p-112, -0x1.0cf295a6f479bp5},
{0x1.3ffffffffffd8p-111, -0x1.0a8a133ce08a8p5},
{0x1.4p-111, -0x1.0a8a133ce08a7p5},
{0x1.3fffffffffa73p-110, -0x1.082190d2cc9c2p5},
{0x1.4p-110, -0x1.082190d2cc9b3p5},
{0x1.3fffffffffec5p-109, -0x1.05b90e68b8ac2p5},
{0x1.4p-109, -0x1.05b90e68b8abfp5},
{0x1.3ffffffffedddp-108, -0x1.03508bfea4bfep5},
{0x1.3ffffffffff7ep-108, -0x1.03508bfea4bccp5},
{0x1.4p-108, -0x1.03508bfea4bcbp5},
{0x1.3ffffffffde65p-107, -0x1.00e8099490d35p5},
{0x1.3fffffffffe0ep-107, -0x1.00e8099490cdcp5},
{0x1.4p-107, -0x1.00e8099490cd7p5},
{0x1.3ffffffffed3dp-106, -0x1.fcff0e54f9c2fp4},
{0x1.3fffffffffe82p-106, -0x1.fcff0e54f9bcep4},
{0x1.4p-106, -0x1.fcff0e54f9bc6p4},
{0x1.3fffffffffff3p-105, -0x1.f82e0980d1ddep4},
{0x1.4p-105, -0x1.f82e0980d1ddep4},
{0x1.3ffffffffff98p-104, -0x1.f35d04aca9ff8p4},
{0x1.4p-104, -0x1.f35d04aca9ff6p4},
{0x1.3ffffffffe3b7p-103, -0x1.ee8bffd8822abp4},
{0x1.3ffffffffffc7p-103, -0x1.ee8bffd88221p4},
{0x1.4p-103, -0x1.ee8bffd88220ep4},
{0x1.3fffffffffdcdp-102, -0x1.e9bafb045a432p4},
{0x1.4p-102, -0x1.e9bafb045a426p4},
{0x1.3ffffffffff3ep-101, -0x1.e4e9f63032642p4},
{0x1.4p-101, -0x1.e4e9f6303263ep4},
{0x1.3ffffffffe301p-100, -0x1.e018f15c0a8f8p4},
{0x1.3fffffffffff7p-100, -0x1.e018f15c0a856p4},
{0x1.4p-100, -0x1.e018f15c0a856p4},
{0x1.3fffffffffd73p-99, -0x1.db47ec87e2a7cp4},
{0x1.4p-99, -0x1.db47ec87e2a6ep4},
{0x1.3ffffffffdd9dp-98, -0x1.d676e7b3bad46p4},
{0x1.3fffffffffee4p-98, -0x1.d676e7b3bac8cp4},
{0x1.4p-98, -0x1.d676e7b3bac86p4},
{0x1.3ffffffffff9dp-97, -0x1.d1a5e2df92eap4},
{0x1.4p-97, -0x1.d1a5e2df92e9ep4},
{0x1.3fffffffffffap-96, -0x1.ccd4de0b6b0b6p4},
{0x1.4p-96, -0x1.ccd4de0b6b0b6p4},
{0x1.3ffffffffffcdp-95, -0x1.c803d937432dp4},
{0x1.4p-95, -0x1.c803d937432cep4},
{0x1.3ffffffffffcep-94, -0x1.c332d4631b4e8p4},
{0x1.4p-94, -0x1.c332d4631b4e6p4},
{0x1.3fffffffffe8cp-93, -0x1.be61cf8ef3706p4},
{0x1.4p-93, -0x1.be61cf8ef36fep4},
{0x1.3fffffffff983p-92, -0x1.b990cabacb93ap4},
{0x1.3ffffffffff45p-92, -0x1.b990cabacb91ap4},
{0x1.4p-92, -0x1.b990cabacb916p4},
{0x1.3fffffffffffep-91, -0x1.b4bfc5e6a3b2ep4},
{0x1.4p-91, -0x1.b4bfc5e6a3b2ep4},
{0x1.3fffffffffdd6p-90, -0x1.afeec1127bd52p4},
{0x1.4p-90, -0x1.afeec1127bd46p4},
{0x1.3fffffffffeebp-89, -0x1.ab1dbc3e53f64p4},
{0x1.4p-89, -0x1.ab1dbc3e53f5ep4},
{0x1.3ffffffffffa4p-88, -0x1.a64cb76a2c178p4},
{0x1.4p-88, -0x1.a64cb76a2c177p4},
{0x1.3fffffffffa9bp-87, -0x1.a17bb296043acp4},
{0x1.3fffffffffd7cp-87, -0x1.a17bb2960439cp4},
{0x1.4p-87, -0x1.a17bb2960438fp4},
{0x1.3fffffffffe91p-86, -0x1.9caaadc1dc5aep4},
{0x1.3ffffffffffc5p-86, -0x1.9caaadc1dc5a8p4},
{0x1.3fffffffffe36p-85, -0x1.97d9a8edb47c8p4},
{0x1.3ffffffffffa7p-84, -0x1.9308a4198c9d8p4},
{0x1.3ffffffffff7ap-83, -0x1.8e379f4564bf2p4},
{0x1.3ffffffffffd7p-82, -0x1.89669a713ce08p4},
{0x1.3fffffffffe95p-81, -0x1.8495959d15026p4},
{0x1.3ffffffffff4ep-80, -0x1.7fc490c8ed23ap4},
{0x1.3ffffffffeafbp-79, -0x1.7af38bf4c54c3p4},
{0x1.3ffffffffffd9p-79, -0x1.7af38bf4c544fp4},
{0x1.3fffffffffe3bp-78, -0x1.762287209d67p4},
{0x1.3ffffffffde65p-77, -0x1.7151824c7593ap4},
{0x1.3fffffffffef4p-77, -0x1.7151824c75884p4},
{0x1.3ffffffffffadp-76, -0x1.6c807d784da98p4},
{0x1.3fffffffffb8bp-75, -0x1.67af78a425cc7p4},
{0x1.3ffffffffffaep-75, -0x1.67af78a425cbp4},
{0x1.3ffffffffffddp-74, -0x1.62de73cffdec8p4},
{0x1.3fffffffffe3fp-73, -0x1.5e0d6efbd60e8p4},
{0x1.3ffffffffff54p-72, -0x1.593c6a27ae2fap4},
{0x1.3ffffffffffb1p-71, -0x1.546b65538651p4},
{0x1.3fffffffff571p-70, -0x1.4f9a607f5e762p4},
{0x1.3fffffffffde5p-70, -0x1.4f9a607f5e732p4},
{0x1.3fffffffffe9ep-69, -0x1.4ac95bab36946p4},
{0x1.3ffffffffffb3p-68, -0x1.45f856d70eb58p4},
{0x1.3ffffffffe1d7p-67, -0x1.41275202e6e16p4},
{0x1.3ffffffffffb4p-67, -0x1.41275202e6d7p4},
{0x1.3fffffffffe44p-66, -0x1.3c564d2ebef9p4},
{0x1.3fffffffffd5fp-65, -0x1.3785485a971aep4},
{0x1.3fffffffffaadp-64, -0x1.32b443866f3d5p4},
{0x1.3fffffffffefep-64, -0x1.32b443866f3bcp4},
{0x1.3ffffffffeb35p-63, -0x1.2de33eb247643p4},
{0x1.3ffffffffffb7p-63, -0x1.2de33eb2475dp4},
{0x1.3ffffffffffe6p-62, -0x1.291239de1f7e8p4},
{0x1.3fffffffffdecp-61, -0x1.24413509f7a0ap4},
{0x1.3ffffffffff5dp-60, -0x1.1f703035cfc1ap4},
{0x1.3ffffffffffbap-59, -0x1.1a9f2b61a7e3p4},
{0x1.3fffffffffd92p-58, -0x1.15ce268d80054p4},
{0x1.3ffffffffff03p-57, -0x1.10fd21b958264p4},
{0x1.3ffffffffe6e9p-56, -0x1.0c2c1ce530503p4},
{0x1.3ffffffffffbcp-56, -0x1.0c2c1ce530478p4},
{0x1.3ffffffffe2c7p-55, -0x1.075b181108731p4},
{0x1.3ffffffffff61p-55, -0x1.075b181108692p4},
{0x1.3ffffffffffecp-54, -0x1.028a133ce08a8p4},
{0x1.3fffffffff14fp-53, -0x1.fb721cd171621p3},
{0x1.3fffffffffff8p-53, -0x1.fb721cd17157ep3},
{0x1.3ffffffffdd9dp-52, -0x1.f1d0132921b2dp3},
{0x1.3ffffffffffe2p-52, -0x1.f1d01329219bp3},
{0x1.3ffffffffebebp-51, -0x1.e82e0980d1ebdp3},
{0x1.3fffffffffe2dp-51, -0x1.e82e0980d1df2p3},
{0x1.3ffffffffff7p-50, -0x1.de8bffd882214p3},
{0x1.3fffffffffaadp-49, -0x1.d4e9f6303267ap3},
{0x1.3ffffffffffcdp-49, -0x1.d4e9f6303264p3},
{0x1.3fffffffffd77p-48, -0x1.cb47ec87e2a8ap3},
{0x1.3fffffffffda5p-48, -0x1.cb47ec87e2a89p3},
{0x1.3ffffffffff16p-47, -0x1.c1a5e2df92ea8p3},
{0x1.3fffffffff983p-46, -0x1.b803d93743316p3},
{0x1.3ffffffffffcfp-46, -0x1.b803d937432dp3},
{0x1.3ffffffffffa2p-45, -0x1.ae61cf8ef3702p3},
{0x1.3fffffffffbc5p-44, -0x1.a4bfc5e6a3b5ep3},
{0x1.3ffffffffffffp-44, -0x1.a4bfc5e6a3b2ep3},
{0x1.3fffffffffdd7p-43, -0x1.9b1dbc3e53f76p3},
{0x1.3fffffffffebep-42, -0x1.917bb2960439cp3},
{0x1.3ffffffffe3f1p-41, -0x1.87d9a8edb48f7p3},
{0x1.3ffffffffff77p-41, -0x1.87d9a8edb47c4p3},
{0x1.3fffffffff23fp-40, -0x1.7e379f4564c87p3},
{0x1.3ffffffffffbdp-40, -0x1.7e379f4564bf2p3},
{0x1.3fffffffffe36p-39, -0x1.7495959d15032p3},
{0x1.3ffffffffecdbp-38, -0x1.6af38bf4c5523p3},
{0x1.3ffffffffffa7p-38, -0x1.6af38bf4c5452p3},
{0x1.3ffffffffffd6p-37, -0x1.6151824c7588p3},
{0x1.3ffffffffffeep-36, -0x1.57af78a425cafp3},
{0x1.3ffffffffdcadp-35, -0x1.4e0d6efbd6268p3},
{0x1.3ffffffffffefp-35, -0x1.4e0d6efbd60ep3},
{0x1.3fffffffffe68p-34, -0x1.446b65538652p3},
{0x1.3ffffffffeafbp-33, -0x1.3ac95bab36a28p3},
{0x1.3ffffffffffd9p-33, -0x1.3ac95bab3694p3},
{0x1.3ffffffffffdap-32, -0x1.31275202e6d7p3},
{0x1.3fffffffffcb5p-31, -0x1.2785485a971c4p3},
{0x1.3ffffffffffc4p-31, -0x1.2785485a971a2p3},
{0x1.3fffffffffec7p-30, -0x1.1de33eb2475dcp3},
{0x1.3ffffffffffaep-29, -0x1.14413509f7a02p3},
{0x1.3ffffffffd9a3p-28, -0x1.0a9f2b61a7fd9p3},
{0x1.3ffffffffffddp-28, -0x1.0a9f2b61a7e3p3},
{0x1.3fffffffff32fp-27, -0x1.00fd21b9582edp3},
{0x1.3fffffffffe6dp-27, -0x1.00fd21b95827p3},
{0x1.3ffffffffffe4p-26, -0x1.eeb6302210d2p2},
{0x1.3ffffffffeb35p-25, -0x1.db721cd17174dp2},
{0x1.3fffffffffffcp-25, -0x1.db721cd17157ep2},
{0x1.3ffffffffde65p-24, -0x1.c82e0980d20cap2},
{0x1.3fffffffffeafp-24, -0x1.c82e0980d1dfcp2},
{0x1.3ffffffffed3dp-23, -0x1.b4e9f630327ep2},
{0x1.3ffffffffff7fp-23, -0x1.b4e9f6303264ap2},
{0x1.3ffffffffffdcp-22, -0x1.a1a5e2df92ea2p2},
{0x1.3ffffffffe91bp-21, -0x1.8e61cf8ef38fbp2},
{0x1.3ffffffffffffp-21, -0x1.8e61cf8ef36fep2},
{0x1.3fffffffffeb2p-20, -0x1.7b1dbc3e53f7bp2},
{0x1.3ffffffffe3b7p-19, -0x1.67d9a8edb4a33p2},
{0x1.3ffffffffff3dp-19, -0x1.67d9a8edb47dp2},
{0x1.3ffffffffe6e9p-18, -0x1.5495959d1524dp2},
{0x1.3fffffffffff6p-18, -0x1.5495959d1502p2},
{0x1.3ffffffffdb5bp-17, -0x1.4151824c75badp2},
{0x1.3ffffffffffebp-17, -0x1.4151824c7588p2},
{0x1.3ffffffffe301p-16, -0x1.2e0d6efbd6364p2},
{0x1.3ffffffffff11p-16, -0x1.2e0d6efbd60f3p2},
{0x1.3fffffffff14fp-15, -0x1.1ac95bab36a85p2},
{0x1.3ffffffffff57p-15, -0x1.1ac95bab3694ep2},
{0x1.3fffffffff481p-14, -0x1.0785485a9729fp2},
{0x1.3fffffffffff9p-14, -0x1.0785485a971ap2},
{0x1.3fffffffff571p-13, -0x1.e8826a13ef5d4p1},
{0x1.3fffffffffff1p-13, -0x1.e8826a13ef4p1},
{0x1.3fffffffffc7bp-12, -0x1.c1fa4372b055ap1},
{0x1.3ffffffffffcfp-12, -0x1.c1fa4372b04c6p1},
{0x1.3fffffffff189p-11, -0x1.9b721cd171802p1},
{0x1.3fffffffffffep-11, -0x1.9b721cd17157ep1},
{0x1.3ffffffffe211p-10, -0x1.74e9f63032b72p1},
{0x1.3fffffffffff3p-10, -0x1.74e9f6303264p1},
{0x1.3fffffffffbc5p-9, -0x1.4e61cf8ef37bbp1},
{0x1.3fffffffffff4p-9, -0x1.4e61cf8ef37p1},
{0x1.3fffffffff391p-8, -0x1.27d9a8edb49e8p1},
{0x1.3ffffffffffe9p-8, -0x1.27d9a8edb47c2p1},
{0x1.3fffffffffaadp-7, -0x1.0151824c7596cp1},
{0x1.3ffffffffffeap-7, -0x1.0151824c75882p1},
{0x1.3fffffffffc7bp-6, -0x1.b592b7566d3b6p0},
{0x1.3fffffffffff2p-6, -0x1.b592b7566d282p0},
{0x1.3fffffffffda5p-5, -0x1.68826a13ef4dp0},
{0x1.3fffffffffff6p-5, -0x1.68826a13ef402p0},
{0x1.3fffffffffb8bp-4, -0x1.1b721cd17170ap0},
{0x1.3ffffffffffffp-4, -0x1.1b721cd17157ep0},
{0x1.3fffffffffcb5p-3, -0x1.9cc39f1de7047p-1},
{0x1.3fffffffffff2p-3, -0x1.9cc39f1de6e06p-1},
{0x1.3fffffffffc7bp-2, -0x1.02a30498eb36fp-1},
{0x1.4p-2, -0x1.02a30498eb0fep-1},
{0x1.3fffffffffda5p-1, -0x1.a209a84fbd684p-3},
{0x1.3fffffffffffcp-1, -0x1.a209a84fbd002p-3},
{0x1.3fffffffffff3p0, 0x1.8cf18388647c5p-4},
{0x1.3fffffffffffdp0, 0x1.8cf18388647fbp-4},
{0x1.3ffffffffff7bp1, 0x1.977d95ec10b4ap-2},
{0x1.3fffffffffffcp1, 0x1.977d95ec10bfcp-2},
{0x1.3ffffffffff2bp2, 0x1.65df657b0426dp-1},
{0x1.3fffffffffff3p2, 0x1.65df657b042f8p-1},
{0x1.3fffffffffc83p4, 0x1.4d104d427dd4ap0},
{0x1.3fffffffffff1p4, 0x1.4d104d427de7ap0},
{0x1.4p4, 0x1.4d104d427de8p0},
{0x1.3ffffffffff2bp5, 0x1.9a209a84fbcb6p0},
{0x1.4p5, 0x1.9a209a84fbdp0},
{0x1.3fffffffffd23p6, 0x1.e730e7c779a81p0},
{0x1.3fffffffffffep6, 0x1.e730e7c779b7ep0},
{0x1.4p6, 0x1.e730e7c779b7fp0},
{0x1.3ffffffffece3p7, 0x1.1a209a84fb9aep1},
{0x1.4p7, 0x1.1a209a84fbdp1},
{0x1.3fffffffffeb3p8, 0x1.40a8c1263ac06p1},
{0x1.3ffffffffff71p8, 0x1.40a8c1263ac26p1},
{0x1.4p8, 0x1.40a8c1263ac3fp1},
{0x1.3fffffffffe3bp9, 0x1.6730e7c779b31p1},
{0x1.3fffffffffffcp9, 0x1.6730e7c779b7ep1},
{0x1.4p9, 0x1.6730e7c779b7fp1},
{0x1.3fffffffff657p10, 0x1.8db90e68b8912p1},
{0x1.3ffffffffff67p10, 0x1.8db90e68b8aa4p1},
{0x1.4p10, 0x1.8db90e68b8abfp1},
{0x1.3fffffffff8ffp11, 0x1.b4413509f78c8p1},
{0x1.3ffffffffffecp11, 0x1.b4413509f79fcp1},
{0x1.4p11, 0x1.b4413509f79ffp1},
{0x1.3fffffffffd23p12, 0x1.dac95bab368cp1},
{0x1.3ffffffffff5dp12, 0x1.dac95bab36922p1},
{0x1.4p12, 0x1.dac95bab3693fp1},
{0x1.3fffffffffe13p13, 0x1.00a8c1263ac15p2},
{0x1.3fffffffffee2p13, 0x1.00a8c1263ac26p2},
{0x1.4p13, 0x1.00a8c1263ac3fp2},
{0x1.3fffffffff193p14, 0x1.13ecd476da29fp2},
{0x1.3ffffffffffc9p14, 0x1.13ecd476da3dap2},
{0x1.4p14, 0x1.13ecd476da3dfp2},
{0x1.3fffffffff5b7p15, 0x1.2730e7c779a9bp2},
{0x1.3ffffffffff1dp15, 0x1.2730e7c779b6cp2},
{0x1.4p15, 0x1.2730e7c779b7fp2},
{0x1.3ffffffffec2fp16, 0x1.3a74fb1819167p2},
{0x1.3ffffffffffedp16, 0x1.3a74fb181931ep2},
{0x1.4p16, 0x1.3a74fb181931fp2},
{0x1.3fffffffffb07p17, 0x1.4db90e68b8a51p2},
{0x1.3fffffffffecep17, 0x1.4db90e68b8aa4p2},
{0x1.4p17, 0x1.4db90e68b8abfp2},
{0x1.3ffffffffff2bp18, 0x1.60fd21b95824dp2},
{0x1.3ffffffffffb5p18, 0x1.60fd21b958258p2},
{0x1.4p18, 0x1.60fd21b95825fp2},
{0x1.3ffffffffffe4p19, 0x1.74413509f79fcp2},
{0x1.4p19, 0x1.74413509f79ffp2},
{0x1.3fffffffff6cfp20, 0x1.8785485a970d3p2},
{0x1.3ffffffffffd9p20, 0x1.8785485a9719cp2},
{0x1.4p20, 0x1.8785485a9719fp2},
{0x1.3ffffffffed47p21, 0x1.9ac95bab3679fp2},
{0x1.3fffffffffebap21, 0x1.9ac95bab36922p2},
{0x1.4p21, 0x1.9ac95bab3693fp2},
{0x1.3fffffffff16bp22, 0x1.ae0d6efbd5f9bp2},
{0x1.3ffffffffff8ap22, 0x1.ae0d6efbd60d4p2},
{0x1.4p22, 0x1.ae0d6efbd60dfp2},
{0x1.3ffffffffe667p23, 0x1.c151824c75646p2},
{0x1.3fffffffffffep23, 0x1.c151824c7587ep2},
{0x1.4p23, 0x1.c151824c7587fp2},
{0x1.3fffffffffff3p24, 0x1.d495959d1501ep2},
{0x1.4p24, 0x1.d495959d1501fp2},
{0x1.3fffffffffadfp25, 0x1.e7d9a8edb474dp2},
{0x1.3fffffffffebdp25, 0x1.e7d9a8edb47a2p2},
{0x1.4p25, 0x1.e7d9a8edb47bfp2},
// Julia worst-case
{0x1.10f12374877e3p0, 0x1.c7f8d2e32f5e9p-6},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{0x1.de02157073b31p-1, -0x1.e8cfabf160ec6p-6},
{0x1.10fdf4211fd45p+0, 0x1.c946e0d48c148p-6},
{0x1.55535a0140a21p+0, 0x1.ffb56ebe85597p-4},
{0x1.803dea263187fp-1, -0x1.fea1086f5a316p-4},
};
for (double[] testCase: testCases)
failures+=testLog10Case(testCase[0], testCase[1]);
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.log10 against transliteration port of log10.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x;
// Test just above subnormal threshold...
x = Double.MIN_NORMAL;
failures += testRange(x, Math.ulp(x), 1000);
// ... and just below subnormal threshold ...
x = Math.nextDown(Double.MIN_NORMAL);
failures += testRange(x, -Math.ulp(x), 1000);
// ... and near 1.0 ...
x = 1.0;
failures += testRange(x, Math.ulp(x), 1000);
x = Math.nextDown(1.0);
failures += testRange(x, -Math.ulp(x), 1000);
x = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold. Don't worry about test
// elements overflowing to infinity if the starting value is
// near Double.MAX_VALUE.
failures += testRange(x, 2.0 * Math.ulp(x), 1000);
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testLog10Case(x, FdlibmTranslit.log10(x));
}
return failures;
}
}

View file

@ -0,0 +1,297 @@
/*
* Copyright (c) 2003, 2025, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4851638 8301392
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build Log1pTests
* @run main Log1pTests
* @summary Tests for StrictMath.log1p
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/Log1pTests.java test properties that should
* hold for any log1p implementation, including the FDLIBM-based one
* required for StrictMath.log1p. Therefore, the test cases in
* ../Math/Log1pTests.java are run against both the Math and
* StrictMath versions of log1p. The role of this test is to verify
* that the FDLIBM log1p algorithm is being used by running golden
* file tests on values that may vary from one conforming log1p
* implementation to another.
*/
public class Log1pTests {
private Log1pTests(){}
public static void main(String... args) {
int failures = 0;
failures += testLog1p();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing log1p incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
static int testLog1pCase(double input, double expected) {
return Tests.test("StrictMath.log1p(double)", input,
StrictMath::log1p, expected);
}
static int testLog1p() {
int failures = 0;
double [][] testCases = {
{0x1.fffffffffffffp-54, 0x1.fffffffffffffp-54},
{0x1.fffffffffcc48p-15, 0x1.fffc000aa74f3p-15},
{0x1.ffffffffff224p-14, 0x1.fff8002aa8ccfp-14},
{0x1.ffffffffff90cp-13, 0x1.fff000aaa23bdp-13},
{0x1.fffffffffffcep-4, 0x1.e27076e2af2bap-4},
{0x1.fffffffffffffp-2, 0x1.9f323ecbf984bp-2},
{0x1.ffffffffffffdp-1, 0x1.62e42fefa39eep-1},
{0x1.0p1, 0x1.193ea7aad030ap0},
{0x1.ffffffffffffbp1, 0x1.9c041f7ed8d31p0},
{0x1.fffffffffffffp2, 0x1.193ea7aad030ap1},
{0x1.fffffffffffe1p3, 0x1.6aa6bc1fa7f73p1},
{0x1.fffffffffffe1p4, 0x1.bf8d8f4d5b8cap1},
{0x1.ffffffffffff1p5, 0x1.0b29293942974p2},
{0x1.fffffffffff41p6, 0x1.37072a9b5b6b4p2},
{0x1.ffffffffffe65p7, 0x1.63241004e8fdep2},
{0x1.ffffffffffca1p8, 0x1.8f60adf041b73p2},
{0x1.fffffffffffffp9, 0x1.bbad39ebe1ccp2},
{0x1.fffffffffffffp10, 0x1.e801c1698ba43p2},
{0x1.ffffffffff2dep11, 0x1.0a2d23e3bb54bp3},
{0x1.ffffffffff18dp12, 0x1.205a66eeb4f81p3},
{0x1.ffffffffffff9p13, 0x1.368829f0af2dcp3},
{0x1.fffffffffbc1ep14, 0x1.4cb62cf069217p3},
{0x1.ffffffffffff5p16, 0x1.791282ee99d8ep3},
{0x1.fffffffffba46p17, 0x1.8f40bded96cd1p3},
{0x1.ffffffffffff7p18, 0x1.a56efcec920cbp3},
{0x1.ffffffffffff7p19, 0x1.bb9d3deb8c76ap3},
{0x1.ffffffffffff9p20, 0x1.d1cb7fea86bcap3},
{0x1.ffffffffffff7p24, 0x1.1542457b37d42p4},
{0x1.fffffffffffe7p29, 0x1.4cb5ecf0e964fp4},
{0x1.ffffffffffff9p30, 0x1.57cd0e704682p4},
{0x1.ffffffffffffbp34, 0x1.8429946e1cf5dp4},
{0x1.fffffffffffedp35, 0x1.8f40b5ed9912dp4},
{0x1.fffffffffffefp39, 0x1.bb9d3beb8c96ap4},
{0x1.fffffffffffe1p40, 0x1.c6b45d6b09abap4},
{0x1.fffffffffffe3p44, 0x1.f310e368fe17fp4},
{0x1.ffffffffffff5p45, 0x1.fe2804e87b34cp4},
{0x1.fffffffffffc5p66, 0x1.7386e22edf4a5p5},
{0x1.fffffffffff98p90, 0x1.f89c7428bca5fp5},
{0x1.a36e2eb1c317dp-14, 0x1.a368d0657ee51p-14},
{0x1.0624dd2f18d5cp-10, 0x1.060354f8c2226p-10},
{0x1.ffffffffffffdp-1, 0x1.62e42fefa39eep-1},
{0x1.8ffffffffffccp6, 0x1.275e2271bba28p2},
{0x1.f3fffffffff1p9, 0x1.ba2909ce4f846p2},
{0x1.387ffffffffa8p13, 0x1.26bbed6fbd838p3},
{0x1.869ffffffffe4p16, 0x1.7069f7a2d94f4p3},
{0x1.e847fffffff3ep19, 0x1.ba18abb1dedbcp3},
{0x1.312cfffffff23p23, 0x1.01e3b85ec299p4},
{0x1.7d783ffffff17p26, 0x1.26bb1bbe0482ap4},
{0x1.dcd64ffffffcep29, 0x1.4b927f3304b3ap4},
{0x1.2a05f1ffffa3p33, 0x1.7069e2aa317fep4},
{0x1.74876e7ffffbep36, 0x1.9541462195ffap4},
{0x1.d1a94a1fffddp39, 0x1.ba18a999000a6p4},
{0x1.2309ce53ffed2p43, 0x1.def00d106aa4ep4},
{0x1.6bcc41e8ffe73p46, 0x1.01e3b843eaa6cp5},
{0x1.c6bf52633fe7dp49, 0x1.144f69ff9ffbep5},
{0x1.1c37937e07fffp53, 0x1.26bb1bbb55515p5},
{0x1.6345785d89f12p56, 0x1.3926cd770aa62p5},
{0x1.bc16d674ec76ap59, 0x1.4b927f32bffb6p5},
{0x1.158e460913c51p63, 0x1.5dfe30ee75504p5},
{0x1.5af1d78b58badp66, 0x1.7069e2aa2aa58p5},
{0x1.b1ae4d6e2ecd4p69, 0x1.82d59465dffap5},
{0x1.0f0cf064dd066p73, 0x1.95414621954d6p5},
{0x1.52d02c7e14a9p76, 0x1.a7acf7dd4aa4cp5},
{0x1.a784379d99c19p79, 0x1.ba18a998fff98p5},
{0x1.08b2a2c27fb5p83, 0x1.cc845b54b54bap5},
{0x1.4adf4b7320322p86, 0x1.def00d106aa42p5},
{0x1.9d971e4fe7b91p89, 0x1.f15bbecc1ff6ap5},
{0x1.027e72f1f0ea3p93, 0x1.01e3b843eaa63p6},
{0x1.431e0fae6d44bp96, 0x1.0b199121c5512p6},
{0x1.93e5939a086bcp99, 0x1.144f69ff9ffb4p6},
{0x1.f8def8808ac86p102, 0x1.1d8542dd7aa65p6},
{0x1.3b8b5b5056dc7p106, 0x1.26bb1bbb55514p6},
{0x1.8a6e32246c76cp109, 0x1.2ff0f4992ffb8p6},
{0x1.ed09bead86a07p112, 0x1.3926cd770aa41p6},
{0x1.3426172c74d33p116, 0x1.425ca654e550ep6},
{0x1.812f9cf791f1ep119, 0x1.4b927f32bffb4p6},
{0x1.e17b8435758f2p122, 0x1.54c858109aa3ep6},
{0x1.2ced32a169cfap126, 0x1.5dfe30ee754fap6},
{0x1.78287f49c497cp129, 0x1.673409cc4ffbp6},
{0x1.d6329f1c3492ep132, 0x1.7069e2aa2aa3p6},
{0x1.25dfa371a14b8p136, 0x1.799fbb88054f2p6},
{0x1.6f578c4e09f0ap139, 0x1.82d59465dffa8p6},
{0x1.cb2d6f618c4b4p142, 0x1.8c0b6d43baa4cp6},
{0x1.1efc659cf77abp146, 0x1.95414621954eap6},
{0x1.66bb7f0435c5bp149, 0x1.9e771eff6ffa6p6},
{0x1.c06a5ec5428a4p152, 0x1.a7acf7dd4aa36p6},
{0x1.18427b3b49fc9p156, 0x1.b0e2d0bb254f6p6},
{0x1.5e531a0a1c729p159, 0x1.ba18a998fff9cp6},
{0x1.b5e7e08ca3686p162, 0x1.c34e8276daa4p6},
{0x1.11b0ec57e6492p166, 0x1.cc845b54b54f2p6},
{0x1.561d276ddfd7dp169, 0x1.d5ba34328ff9ap6},
{0x1.aba471495757bp172, 0x1.def00d106aa3p6},
{0x1.0b46c6cdd6a8ep176, 0x1.e825e5ee454ddp6},
{0x1.4e1878814c5f4p179, 0x1.f15bbecc1ff88p6},
{0x1.a19e96a19f65ap182, 0x1.fa9197a9faa2ep6},
{0x1.05031e2503cfcp186, 0x1.01e3b843eaa71p7},
{0x1.4643e5ae441d2p189, 0x1.067ea4b2d7fb6p7},
{0x1.97d4df19d5c5dp192, 0x1.0b199121c5516p7},
{0x1.fdca16e04ae24p195, 0x1.0fb47d90b2a65p7},
{0x1.3e9e4e4c2f2dap199, 0x1.144f69ff9ffc4p7},
{0x1.8e45e1df3ac31p202, 0x1.18ea566e8d514p7},
{0x1.f1d75a5709306p205, 0x1.1d8542dd7aa63p7},
{0x1.372698766608cp209, 0x1.22202f4c67fcp7},
{0x1.84f03e93fef5p212, 0x1.26bb1bbb55508p7},
{0x1.e62c4e38fdba1p215, 0x1.2b56082a42a4bp7},
{0x1.2fdbb0e39f6b8p219, 0x1.2ff0f4992ffb6p7},
{0x1.7bd29d1c875a2p222, 0x1.348be1081d50cp7},
{0x1.dac74463a76e9p225, 0x1.3926cd770aa42p7},
{0x1.28bc8abe48f57p229, 0x1.3dc1b9e5f7fap7},
{0x1.72ebad6ddc67ep232, 0x1.425ca654e550ep7},
{0x1.cfa698c952a3ap235, 0x1.46f792c3d2a53p7},
{0x1.21c81f7dd42b1p239, 0x1.4b927f32bffb6p7},
{0x1.6a3a275d4926bp242, 0x1.502d6ba1ad50ap7},
{0x1.c4c8b134970ddp245, 0x1.54c858109aa0ep7},
{0x1.61bcca711985dp252, 0x1.5dfe30ee75508p7},
{0x1.ba2bfd0d5fe2ap255, 0x1.62991d5d62a5cp7},
{0x1.59725db2728b7p262, 0x1.6bcef63b3d4fcp7},
{0x1.afcef51f0fa33p265, 0x1.7069e2aa2aa5ap7},
{0x1.0de1593368f8cp269, 0x1.7504cf1917f95p7},
{0x1.5159af804425ep272, 0x1.799fbb88055p7},
{0x1.a5b01b605409p275, 0x1.7e3aa7f6f2a3ep7},
{0x1.078e111c34e5bp279, 0x1.82d59465dff9fp7},
{0x1.497195634225fp282, 0x1.877080d4cd4f4p7},
{0x1.9bcdfabc13053p285, 0x1.8c0b6d43baa4ep7},
{0x1.0160bcb58c08cp289, 0x1.90a659b2a7fa7p7},
{0x1.41b8ebe2eec13p292, 0x1.95414621954f4p7},
{0x1.922726dbaa542p295, 0x1.99dc329082a46p7},
{0x1.f6b0f09295714p298, 0x1.9e771eff6ffa3p7},
{0x1.3a2e965b9d0b2p302, 0x1.a3120b6e5d4eep7},
{0x1.88ba3bf284dd1p305, 0x1.a7acf7dd4aa4ep7},
{0x1.32d17ed576f35p312, 0x1.b0e2d0bb254ep7},
{0x1.7f85de8ad56bep315, 0x1.b57dbd2a12a44p7},
{0x1.df67562d87c5cp318, 0x1.ba18a998fff65p7},
{0x1.2ba095dc76db7p322, 0x1.beb39607ed4fp7},
{0x1.7688bb5394bd3p325, 0x1.c34e8276daa48p7},
{0x1.d42aea2878b45p328, 0x1.c7e96ee5c7f87p7},
{0x1.249ad2594989p332, 0x1.cc845b54b54a6p7},
{0x1.300240b87b096p-4, 0x1.25417bd05ba95p-4}, // nextUp from Julia value
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{-0x1.2bf183e0344b2p-2, -0x1.62ebb44459d79p-2},
{-0x1.2bf32aaf122e2p-2, -0x1.62ee0a3a4baf9p-2},
{-0x1.8000000000000p-53, -0x1.8000000000001p-53},
{-0x1.2e496d25897ecp-2, -0x1.663d81cb08f56p-2},
{-0x1.ffffffbaefe27p-2, -0x1.62e42faa93817p-1},
{-0x1.5efad5491a79bp-1022, -0x1.5efad5491a79bp-1022},
};
for (double[] testCase: testCases)
failures+=testLog1pCase(testCase[0], testCase[1]);
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.log1p against transliteration port of log1p.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x;
// Test just above subnormal threshold...
x = Double.MIN_NORMAL;
failures += testRange(x, Math.ulp(x), 1000);
// ... and just below subnormal threshold ...
x = Math.nextDown(Double.MIN_NORMAL);
failures += testRange(x, -Math.ulp(x), 1000);
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
1.0,
-0x1.0p-29,
0x1.0p-29,
-0x1.0p-54,
0x1.0p-54,
-0.2930, // approx. sqrt(2)/2 -1
-0.2929,
-0.2928,
0.41421, // approx. sqrt(2) -1
0.41422,
0.41423,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000);
}
x = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold. Don't worry about test
// elements overflowing to infinity if the starting value is
// near Double.MAX_VALUE.
failures += testRange(x, 2.0 * Math.ulp(x), 1000);
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testLog1pCase(x, FdlibmTranslit.log1p(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures += testLog1pCase(x, FdlibmTranslit.log1p(x));
}
return failures;
}
}

View file

@ -0,0 +1,140 @@
/*
* Copyright (c) 2023, 2024, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8301202
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build LogTests
* @run main LogTests
* @summary Tests for StrictMath.log
*/
import jdk.test.lib.RandomFactory;
public class LogTests {
private LogTests(){}
public static void main(String... args) {
int failures = 0;
failures += testLog();
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing log incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
static int testLogCase(double input, double expected) {
return Tests.test("StrictMath.log(double)", input,
StrictMath::log, expected);
}
// Inputs where Math.log and StrictMath.log differ for at least
// one Math.log implementation.
static int testLog() {
int failures = 0;
double [][] testCases = {
{0x1.000000089cd6fp-43, -0x1.dce2a0697a102p4},
{0x1.0000000830698p182, 0x1.f89c7428dd67ap6},
{0x1.0000000744b3ap632, 0x1.b611ab2bd53cep8},
{0x1.000000037d81fp766, 0x1.0979b1dbc4a42p9},
{0x1.000000024028p991, 0x1.577455642bb92p9},
// Empirical worst-case points
{0x1.0ffea3878db6bp+0, 0x1.f07a0cca521fp-5},
{0x1.490af72a25a81p-1, -0x1.c4bf7ae48f078p-2},
{0x1.69e7aa6da2df5p-1, -0x1.634508c9adfp-2},
};
for (double[] testCase: testCases)
failures+=testLogCase(testCase[0], testCase[1]);
return failures;
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.log against transliteration port of log.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x;
// Test just above subnormal threshold...
x = Double.MIN_NORMAL;
failures += testRange(x, Math.ulp(x), 1000);
// ... and just below subnormal threshold ...
x = Math.nextDown(Double.MIN_NORMAL);
failures += testRange(x, -Math.ulp(x), 1000);
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0x1.0p-1022,
0x1.0p-20,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000);
}
x = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold. Don't worry about test
// elements overflowing to infinity if the starting value is
// near Double.MAX_VALUE.
failures += testRange(x, 2.0 * Math.ulp(x), 1000);
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testLogCase(x, FdlibmTranslit.log(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures += testLogCase(x, FdlibmTranslit.log(x));
}
return failures;
}
}

View file

@ -0,0 +1,318 @@
/*
* Copyright (c) 2003, 2026, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8136874 8362376
* @build Tests
* @build PowTests
* @run main PowTests
* @summary Tests for StrictMath.pow
*/
/**
* The tests in ../Math/PowTests.java test properties that should
* hold for any pow implementation, including the FDLIBM-based one
* required for StrictMath.pow. Therefore, the test cases in
* ../Math/PowTests.java are run against both the Math and
* StrictMath versions of pow. The role of this test is to verify
* that the FDLIBM pow algorithm is being used by running golden
* file tests on values that may vary from one conforming pow
* implementation to another.
*/
public class PowTests {
private PowTests(){}
private static final double INFINITY = Double.POSITIVE_INFINITY;
public static void main(String... args) {
int failures = 0;
failures += testPow();
if (failures > 0) {
System.err.println("Testing pow incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
private static int testPow() {
int failures = 0;
double [][] testCases = {
// Probe near decision points of the fdlibm algorithm
{0x1.00000_0000_0001p1, // |x| > 1.0
INFINITY, // infinity
INFINITY // 0
},
{0x1.fffffp-1, // |x| = 0.9999995231628418
0x1.0p31, // 2^31
0.0 // 0
},
{0x1.ffffe_ffffffffp-1, // |x| < 0.9999995231628418
0x1.0p31, // 2^31
0.0 // 0
},
{-0x1.ffffe_ffffffffp-1, // |x| < 0.9999995231628418
0x1.0p31, // 2^31
0.0 // 0
},
{0x1.fffffp-1, // |x| = 0.9999995231628418
0x1.0000000000001p31, // nextUp(2^31)
0.0 // 0
},
{0x1.fffffp-1, // |x| = 0.9999995231628418
0x1.0p31 + 1.0, // 2^31 + 1, odd integer
0.0 // 0
},
{0x1.fffffp-1, // |x| = 0.9999995231628418
0x1.0p31 + 2.0, // 2^31 + 2, even integer
0.0 // 0
},
{0x1.ffffe_ffffffffp-1, // |x| < 0.9999995231628418
0x1.0000000000001p31, // nextUp(2^31)
0.0 // 0
},
{-0x1.ffffe_ffffffffp-1, // |x| < 0.9999995231628418
0x1.0000000000001p31, // nextUp(2^31)
Double.NaN // 0
},
{-0x1.ffffe_ffffffffp-1, // |x| < 0.9999995231628418
0x1.0p31 + 1.0, // 2^31 + 1, odd integer
-0.0 // 0
},
{-0x1.ffffe_ffffffffp-1, // |x| < 0.9999995231628418
0x1.0p31 + 2.0, // 2^31 + 2, even integer
0.0 // 0
},
{0x1.0000000000001p0, // nextUp(1)
0x1.0000000000001p31, // nextUp(2^31)
0x1.00000800002p0
},
{0x1.0000000000001p0, // nextUp(1)
-0x1.0000000000001p31, // -nextUp(2^31)
0x1.fffff000004p-1
},
{-0x1.0000000000001p0, // -nextUp(1)
-0x1.0000000000001p31, // -nextUp(2^31)
Double.NaN
},
{-0x1.0000000000001p0, // -nextUp(1)
0x1.0p31 + 1.0, // 2^31 + 1, odd integer
-0x1.0000080000201p0
},
{-0x1.0000000000001p0, // -nextUp(1)
0x1.0p31 + 2.0, // 2^31 + 2, even integer
0x1.0000080000202p0
},
{0x1.00000_ffff_ffffp0,
0x1.00001_0000_0000p31,
INFINITY
},
// Huge y, |y| > 0x1.00000_ffff_ffffp31 ~2**31 is a decision point
// First y = 0x1.00001_0000_0000p31
{0x1.fffff_ffff_ffffp-1,
0x1.00001_0000_0000p31,
0x1.fffff7ffff9p-1
},
{0x1.fffff_ffff_fffep-1,
0x1.00001_0000_0000p31,
0x1.ffffefffff4p-1
},
{0x1.fffff_0000_0000p-1,
0x1.00001_0000_0000p31,
0.0
},
// Cycle through decision points on x values
{0x1.fffff_0000_0000p-1,
0x1.00001_0000_0000p31,
0.0
},
{-0x1.fffff_0000_0000p-1,
0x1.00001_0000_0000p31,
0.0
},
{0x1.ffffe_ffff_ffffp-1,
0x1.00001_0000_0000p31,
0.0
},
{-0x1.ffffe_ffff_ffffp-1,
0x1.00001_0000_0000p31,
0.0
},
{0x1.00000_ffff_ffffp0,
0x1.00001_0000_0000p31,
INFINITY
},
{0x1.00001_0000_0000p0,
0x1.00001_0000_0000p31,
INFINITY
},
{-0x1.00000_ffff_ffffp0,
0x1.00001_0000_0000p31,
INFINITY
},
{-0x1.00001_0000_0000p0,
0x1.00001_0000_0000p31,
INFINITY
},
// Now y = -0x1.00001_0000_0000p31
{0x1.fffff_0000_0000p-1,
-0x1.00001_0000_0000p31,
INFINITY
},
{-0x1.fffff_0000_0000p-1,
0x1.00001_0000_0000p31,
0.0
},
{0x1.ffffe_ffff_ffffp-1,
-0x1.00001_0000_0000p31,
INFINITY
},
{-0x1.ffffe_ffff_ffffp-1,
-0x1.00001_0000_0000p31,
INFINITY
},
{0x1.00000_ffff_ffffp0,
-0x1.00001_0000_0000p31,
0.0
},
{0x1.00001_0000_0000p0,
-0x1.00001_0000_0000p31,
0.0
},
{-0x1.00000_ffff_ffffp0,
-0x1.00001_0000_0000p31,
0.0
},
{-0x1.00001_0000_0000p0,
-0x1.00001_0000_0000p31,
0.0
},
//-----------------------
{0x1.ffffe_ffff_ffffp-1,
-0x1.00001_0000_0000p31,
INFINITY
},
{0x1.00001_0000_0000p0,
-0x1.00001_0000_0000p31,
0.0
},
{0x1.0000000000002p0, // 1.0000000000000004
0x1.f4add4p30, // 2.1E9
0x1.00000fa56f1a6p0 // 1.0000009325877754
},
// Verify no early overflow
{0x1.0000000000002p0, // 1.0000000000000004
0x1.0642acp31, // 2.2E9
0x1.000010642b465p0, // 1.0000009769967388
},
// Verify proper overflow
{0x1.0000000000002p0, // 1.0000000000000004
0x1.62e42fefa39fp60, // 1.59828858065033216E18
0x1.ffffffffffd9fp1023, // 1.7976931348621944E308
},
// Check refactoring, abs(y) < 2^31, x < sqrt(3/2), x < sqrt(3)
{1.2, // x < sqrt(3/2)
5.0,
2.4883199999999994
},
{1.4142135623730951, // sqrt(3/2) < x < sqrt(3)
5.0,
5.656854249492382
},
{2.23606797749979, // x > sqrt(3)
5.0,
55.901699437494756
},
};
for (double[] testCase: testCases)
failures += testPowCase(testCase[0], testCase[1], testCase[2]);
return failures;
}
private static int testPowCase(double input1, double input2, double expected) {
int failures = 0;
failures += Tests.test("StrictMath.pow(double)", input1, input2,
StrictMath::pow, expected);
return failures;
}
}

View file

@ -0,0 +1,130 @@
/*
* Copyright (c) 2003, 2023, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8302040
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build SqrtTests
* @run main SqrtTests
* @summary Tests for StrictMath.sqrt
*/
import jdk.test.lib.RandomFactory;
/**
* The tests in ../Math/SqrtTests.java test properties that should
* hold for any sqrt implementation, including the FDLIBM-based one
* required for StrictMath.sqrt. Therefore, the test cases in
* ../Math/SqrtTests.java are run against both the Math and
* StrictMath versions of sqrt. The role of this test is to verify
* that the FDLIBM sqrt algorithm is being used by running golden
* file tests on values that may vary from one conforming sqrt
* implementation to another.
*/
public class SqrtTests {
private SqrtTests(){}
public static void main(String... args) {
int failures = 0;
failures += testAgainstTranslit();
if (failures > 0) {
System.err.println("Testing sqrt incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test StrictMath.sqrt against transliteration port of sqrt.
*/
private static int testAgainstTranslit() {
int failures = 0;
double x;
// Test just above subnormal threshold...
x = Double.MIN_NORMAL;
failures += testRange(x, Math.ulp(x), 1000);
// ... and just below subnormal threshold ...
x = Math.nextDown(Double.MIN_NORMAL);
failures += testRange(x, -Math.ulp(x), 1000);
// ... and near 1.0 ...
failures += testRangeMidpoint(1.0, Math.ulp(x), 2000);
// (Note: probes every-other value less than 1.0 due to
// change in the size of an ulp at 1.0.
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
Double.MIN_VALUE,
Double.MAX_VALUE,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000);
}
x = Tests.createRandomDouble(random);
// Make the increment twice the ulp value in case the random
// value is near an exponent threshold. Don't worry about test
// elements overflowing to infinity if the starting value is
// near Double.MAX_VALUE.
failures += testRange(x, 2.0 * Math.ulp(x), 1000);
return failures;
}
private static int testRange(double start, double increment, int count) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures += testSqrtCase(x, FdlibmTranslit.sqrt(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures += testSqrtCase(x, FdlibmTranslit.sqrt(x));
}
return failures;
}
private static int testSqrtCase(double input, double expected) {
return Tests.test("StrictMath.sqrt(double)", input,
StrictMath::sqrt, expected);
}
}

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2003, 2022, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleUnaryOperator;
/*
* Shared static test method for StrictMath tests.
*/
public class Tests {
private Tests(){}
public static int test(String testName,
double input,
DoubleUnaryOperator func,
double expected) {
return test(testName, input, func.applyAsDouble(input), expected);
}
public static int test(String testName,
double input,
double result,
double expected) {
if (Double.compare(expected, result ) != 0) {
System.err.println("Failure for " + testName + ":\n" +
"\tFor input " + input + "\t(" + Double.toHexString(input) + ")\n" +
"\texpected " + expected + "\t(" + Double.toHexString(expected) + ")\n" +
"\tgot " + result + "\t(" + Double.toHexString(result) + ").");
return 1;
} else {
return 0;
}
}
public static int test(String testName,
double input1,
double input2,
DoubleBinaryOperator func,
double expected) {
return test(testName, input1, input2, func.applyAsDouble(input1, input2), expected);
}
public static int test(String testName, double input1, double input2,
double result, double expected) {
if (Double.compare(expected, result ) != 0) {
System.err.println("Failure for " + testName + ":\n" +
"\tFor input " + input1 + "\t(" + Double.toHexString(input1) + "), " +
+ input2 + "\t(" + Double.toHexString(input2) + ")\n" +
"\texpected " + expected + "\t(" + Double.toHexString(expected) + ")\n" +
"\tgot " + result + "\t(" + Double.toHexString(result) + ").");
return 1;
} else {
return 0;
}
}
/**
* Returns a double over the normalized range of floating-point values.
* @return a double over the normalized range of floating-point values
*/
static double createRandomDouble(java.util.Random random) {
final int EXPONENT_RANGE = Double.MAX_EXPONENT - Double.MIN_EXPONENT + 1;
int targetExponent = Double.MIN_EXPONENT + random.nextInt(EXPONENT_RANGE + 1);
double tmp = random.nextDouble(); // Double in the range of [0.0, 1.0)
int tmpExponent = Math.getExponent(tmp);
return Math.scalb(tmp, targetExponent - tmpExponent);
}
}

View file

@ -0,0 +1,335 @@
/*
* Copyright (c) 2003, 2025, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import jdk.test.lib.RandomFactory;
import java.util.function.DoubleUnaryOperator;
/*
* @test
* @bug 8302027
* @key randomness
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @build Tests
* @build FdlibmTranslit
* @build TrigTests
* @run main TrigTests
* @summary Tests for StrictMath.{sin, cos, tan}
*/
/**
* The tests in ../Math/{TanTests.java, SinCosTests.java} test
* properties that should hold for any implementation of the trig
* functions sin, cos, and tan, including the FDLIBM-based ones
* required by the StrictMath class. Therefore, the test cases in
* ../Math/{TanTests.java, SinCosTests.java} are run against both the
* Math and StrictMath versions of the trig methods. The role of this
* test is to verify that the FDLIBM algorithms are being used by
* running golden file tests on values that may vary from one
* conforming implementation of the trig functions to another.
*/
public class TrigTests {
private TrigTests(){}
public static void main(String... args) {
int failures = 0;
failures += testAgainstTranslitCommon();
failures += testAgainstTranslitSin();
failures += testAgainstTranslitCos();
failures += testAgainstTranslitTan();
if (failures > 0) {
System.err.println("Testing the trig functions incurred "
+ failures + " failures.");
throw new RuntimeException();
}
}
/**
* Bundle together groups of testing methods.
*/
private static enum TrigTest {
SIN(TrigTests::testSinCase, FdlibmTranslit::sin),
COS(TrigTests::testCosCase, FdlibmTranslit::cos),
TAN(TrigTests::testTanCase, FdlibmTranslit::tan);
private DoubleDoubleToInt testCase;
private DoubleUnaryOperator transliteration;
TrigTest(DoubleDoubleToInt testCase, DoubleUnaryOperator transliteration) {
this.testCase = testCase;
this.transliteration = transliteration;
}
public DoubleDoubleToInt testCase() {return testCase;}
public DoubleUnaryOperator transliteration() {return transliteration;}
}
// Initialize shared random number generator
private static java.util.Random random = RandomFactory.getRandom();
/**
* Test against shared points of interest.
*/
private static int testAgainstTranslitCommon() {
int failures = 0;
double[] pointsOfInterest = {
Math.PI/4.0,
-Math.PI/4.0,
Math.PI/2.0,
-Math.PI/2.0,
3.0*Math.PI/2.0,
-3.0*Math.PI/2.0,
Math.PI,
-Math.PI,
2.0*Math.PI,
-2.0*Math.PI,
Double.MIN_NORMAL,
1.0,
Tests.createRandomDouble(random),
};
for (var testMethods : TrigTest.values()) {
for (double testPoint : pointsOfInterest) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, testMethods);
}
}
return failures;
}
/**
* Test StrictMath.sin against transliteration port of sin.
*/
private static int testAgainstTranslitSin() {
int failures = 0;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0x1.0p-27,
-0x1.0p-27,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, TrigTest.SIN);
}
// Inputs where Math.sin and StrictMath.sin differ for at least
// one Math.sin implementation.
double [][] testCases = {
{0x1.00000006eeeefp-12, 0x1.ffffffb888889p-13},
{0x1.00000006eeefp-12, 0x1.ffffffb88888bp-13},
{0x1.00000006eeef1p-12, 0x1.ffffffb88888dp-13},
{0x1.000000001bba2p-9, 0x1.ffffeaaae2633p-10},
{0x1.000000000013p-1, 0x1.eaee8744b0806p-2},
{0x1.0000000000012p0, 0x1.aed548f090d02p-1},
{0x1.00000000004e1p9, 0x1.45b52f29ac36p-4},
{0x1.00000000000cp10, -0x1.44ad26136ce5fp-3},
{0x1.000000000020bp11, -0x1.4092047afcd2p-2},
{0x1.0000000000003p12, -0x1.3074ea23314dep-1},
{0x1.0000000000174p50, -0x1.54cd5e7e9e3d2p-1},
{0x1.0000000000005p51, -0x1.8c35b0d728faep-2},
{0x1.0000000000101p113, -0x1.69e9ed300b1dcp-1},
{0x1.0000000000017p114, 0x1.f6b44aa2a1c9cp-1},
{0x1.00000000001abp128, -0x1.ecaddc1136bb2p-1},
{0x1.000000000001bp129, -0x1.682ccb977e4dp-1},
{0x1.0p233, 0x1.7c54e75ed6077p-1},
{0x1.00000000000fcp299, 0x1.78ad2fd7aef78p-1},
{0x1.0000000000002p300, -0x1.1adaf3550facp-1},
{0x1.00000000001afp1023, 0x1.d1c804ef2eeccp-1},
// Empirical worst-case points
{-0x1.f8b791cafcdefp+4, -0x1.073ca87470dfap-3},
{-0x1.0e16eb809a35dp+944, 0x1.b5e361ed01dadp-2},
{-0x1.842d8ec8f752fp+21, -0x1.6ce864edeaffep-1},
{-0x1.1c49ad613ff3bp+19, -0x1.fffe203cfabe1p-2},
};
for (double[] testCase: testCases) {
failures+=testSinCase(testCase[0], testCase[1]);
}
return failures;
}
/**
* Test StrictMath.cos against transliteration port of cos.
*/
private static int testAgainstTranslitCos() {
int failures = 0;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0x1.0p27,
-0x1.0p27,
0.78125,
-0.78125,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, TrigTest.COS);
}
// Inputs where Math.cos and StrictMath.cos differ for at least
// one Math.cos implementation.
double [][] testCases = {
{0x1.000000076aaa6p-10, 0x1.fffff00000147p-1},
{0x1.000000002e4fbp-8, 0x1.ffff00001554fp-1},
{0x1.0000000000318p-2, 0x1.f01549f7dee4p-1},
{0x1.000000000011ep-1, 0x1.c1528065b7cc6p-1},
{0x1.0000000000174p0, 0x1.14a280fb50419p-1},
{0x1.0000000000019p1, -0x1.aa226575372bbp-2},
{0x1.00000000018c9p9, -0x1.fe60f23b0016ap-1},
{0x1.0000000000022p10, 0x1.f98669d7b18d6p-1},
{0x1.0000000000281p11, 0x1.e6439428b217p-1},
{0x1.0000000000001p12, 0x1.9ba4a85e6e173p-1},
{0x1.0000000000211p20, 0x1.e33ad93554beep-1},
{0x1.0000000000006p21, 0x1.9027223f77694p-1},
{0x1.00000000000b8p95, 0x1.8315138968a66p-1},
{0x1.0000000000043p96, 0x1.5b302d1c86cbcp-4},
{0x1.000000000013ap127, -0x1.740d46d7821f4p-1},
{0x1.0000000000002p128, -0x1.e050345cf2161p-1},
{0x1.000000000014p299, 0x1.6c5f3c84352fep-1},
{0x1.0000000000007p300, -0x1.55109bfdf1c5cp-1},
{0x1.000000000010ep400, 0x1.e725637029938p-2},
{0x1.0000000000007p401, 0x1.1f89e14e29ccep-1},
{0x1.0p402, 0x1.be2d53c4560dcp-1},
{0x1.000000000015fp1023, -0x1.2f2596c42735cp-1},
};
for (double[] testCase: testCases) {
failures+=testCosCase(testCase[0], testCase[1]);
}
return failures;
}
/**
* Test StrictMath.tan against transliteration port of tan
*/
private static int testAgainstTranslitTan() {
int failures = 0;
// Probe near decision points in the FDLIBM algorithm.
double[] decisionPoints = {
0x1.0p-28,
-0x1.0p-28,
0.6744,
-0.6744,
};
for (double testPoint : decisionPoints) {
failures += testRangeMidpoint(testPoint, Math.ulp(testPoint), 1000, TrigTest.TAN);
}
// Inputs where Math.tan and StrictMath.tan differ for at least
// one Math.tan implementation.
double [][] testCases = {
{0x1.00000002221fep-13, 0x1.0000001777753p-13},
{0x1.0000000088859p-12, 0x1.00000055dddbp-12},
{0x1.0000000008787p-10, 0x1.000005555defep-10},
{0x1.0000000001423p-9, 0x1.0000155558b9ap-9},
{0x1.00000000005d9p-2, 0x1.05785a43c529p-2},
{0x1.000000000001fp-1, 0x1.17b4f5bf34772p-1},
{0x1.000000000006ep0, 0x1.8eb245cbee51ep0},
{0x1.0000000000032p1, -0x1.17af62e094fd7p1},
{0x1.00000000006a7p9, -0x1.46be0efd0f8cp-4},
{0x1.0p10, -0x1.48d5be43ada01p-3},
{0x1.00000000000c3p32, 0x1.0ad3757181cbap-1},
{0x1.0000000000005p33, 0x1.6e07fbf43d47p0},
{0x1.0000000000124p127, -0x1.3baa73a93958p0},
{0x1.000000000002p128, -0x1.bf05a77a8df0cp-1},
{0x1.000000000011cp299, 0x1.8a6f42eaa3d1fp0},
{0x1.000000000001cp300, -0x1.b30fc9f73002cp-1},
{0x1.0000000000013p500, -0x1.c4e46751be12cp-1},
{0x1.00000000000ep1023, -0x1.d52c4ec04f108p-2},
// Julia worst-case input
{0x1.e608f1390d9fp293, -0x1.9942a10545925p-1},
// Empirical worst-case points in other libraries with
// larger worst-case errors than FDLIBM
{+0x1.371a47b7e4eb2p+11, 0x1.9ded57c9ff46ap-1},
{-0x1.a81d98fc58537p+6 , 0x1.ffd83332326fdp-1},
{-0x1.13a5ccd87c9bbp+1008, -0x1.6a3815320e5cfp-1},
{-0x1.4d7c8b8320237p+11, -0x1.9dec1f1b36ecdp-1},
{+0x1.da7a85a88bbecp+11, 0x1.ff7ae7631230ep-1},
{-0x1.66af736e8555p+18, -0x1.fc3d1cb02536bp-1},
};
for (double[] testCase: testCases) {
failures+=testTanCase(testCase[0], testCase[1]);
}
return failures;
}
private interface DoubleDoubleToInt {
int apply(double x, double y);
}
private static int testRange(double start, double increment, int count,
TrigTest testMethods) {
int failures = 0;
double x = start;
for (int i = 0; i < count; i++, x += increment) {
failures +=
testMethods.testCase().apply(x, testMethods.transliteration().applyAsDouble(x));
}
return failures;
}
private static int testRangeMidpoint(double midpoint, double increment, int count,
TrigTest testMethods) {
int failures = 0;
double x = midpoint - increment*(count / 2) ;
for (int i = 0; i < count; i++, x += increment) {
failures +=
testMethods.testCase().apply(x, testMethods.transliteration().applyAsDouble(x));
}
return failures;
}
private static int testSinCase(double input, double expected) {
return Tests.test("StrictMath.sin(double)", input,
StrictMath::sin, expected);
}
private static int testCosCase(double input, double expected) {
return Tests.test("StrictMath.cos(double)", input,
StrictMath::cos, expected);
}
private static int testTanCase(double input, double expected) {
return Tests.test("StrictMath.tan(double)", input,
StrictMath::tan, expected);
}
}