aboutsummaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-03 12:43:32 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-03 12:43:32 +0000
commitb169f10c58f85743755899fb217214fb2cd8003d (patch)
treec0bd4f19421e979029ba2dcce42921e5dad5d7b0 /math
parenta384fa77082e93b172f129e249b7489ad0c493ad (diff)
downloadglibc-b169f10c58f85743755899fb217214fb2cd8003d.tar
glibc-b169f10c58f85743755899fb217214fb2cd8003d.tar.gz
glibc-b169f10c58f85743755899fb217214fb2cd8003d.tar.bz2
glibc-b169f10c58f85743755899fb217214fb2cd8003d.zip
Update.
1999-06-03 Andreas Jaeger <aj@arthur.rhein-neckar.de> * Makerules: Set LANGUAGE and LC_ALL explicitly to archieve correct sorting of map files. Closes PR libc/1147. 1999-06-03 Andreas Jaeger <aj@arthur.rhein-neckar.de> * math/libm-test.c (main): Add new test functions. (jn_test): New tests. (j1_test): Add some more tests. (j0_test): Add some more tests. (y0_test): Add some more tests. (y1_test): Add some more tests.
Diffstat (limited to 'math')
-rw-r--r--math/libm-test.c179
1 files changed, 172 insertions, 7 deletions
diff --git a/math/libm-test.c b/math/libm-test.c
index b5a9bc1408..5890c3bce8 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -45,13 +45,13 @@
frexp, gamma, hypot,
ilogb, isfinite, isinf, isnan, isnormal,
isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
- j0, j1,
+ j0, j1, jn,
ldexp, lgamma, log, log10, log1p, log2, logb,
modf, nearbyint, nextafter,
pow, remainder, remquo, rint, lrint, llrint,
round, lround, llround,
scalb, scalbn, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
- y0, y1
+ y0, y1, yn
and for the following complex math functions:
cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
@@ -59,7 +59,6 @@
At the moment the following functions aren't tested:
conj, cproj, cimag, creal, drem,
- jn, yn,
significand,
nan
@@ -5509,7 +5508,7 @@ j0_test (void)
/* j0 is the Bessel function of the first kind of order 0 */
check_isnan ("j0 (NaN) = NaN", FUNC(j0) (nan_value));
-
+ check ("j0 (+Inf) = 0", FUNC(j0) (plus_infty), 0);
check ("j0 (-1.0) = 0.76519...", FUNC(j0) (-1.0), 0.76519768655796655145);
check ("j0 (0) = 1", FUNC(j0) (0.0), 1.0);
check ("j0 (0.1) = 0.99750...", FUNC(j0) (0.1), 0.99750156206604003228);
@@ -5533,9 +5532,10 @@ j1_test (void)
/* Function not implemented. */
return;
- /* j is the Bessel function of the first kind of order 1 */
- check_isnan ("j1 (NaN) = NaN", FUNC(j0) (nan_value));
-
+ /* j1 is the Bessel function of the first kind of order 1 */
+ check_isnan ("j1 (NaN) = NaN", FUNC(j1) (nan_value));
+ check ("j1 (+Inf) = 0", FUNC(j1) (plus_infty), 0);
+
check ("j1 (-1.0) = -0.44005...", FUNC(j1) (-1.0), -0.44005058574493351596);
check ("j1 (0) = 0", FUNC(j1) (0.0), 0.0);
check ("j1 (0.1) = 0.049937...", FUNC(j1) (0.1), 0.049937526036241997556);
@@ -5550,6 +5550,84 @@ j1_test (void)
CHOOSE(0, 7e-18, 3.8e-9));
}
+static void
+jn_test (void)
+{
+ errno = 0;
+ FUNC(jn) (1, 1);
+ if (errno == ENOSYS)
+ /* Function not implemented. */
+ return;
+
+ /* jn is the Bessel function of the first kind of order n. */
+
+ /* jn (0, x) == j0 (x) */
+ check_isnan ("jn (0, NaN) = NaN", FUNC(jn) (0, nan_value));
+ check ("jn (0, +Inf) = 0", FUNC(jn) (0, plus_infty), 0);
+ check ("jn (0, -1.0) = 0.76519...", FUNC(jn) (0, -1.0), 0.76519768655796655145);
+ check ("jn (0, 0.0) = 1", FUNC(jn) (0, 0.0), 1.0);
+ check ("jn (0, 0.1) = 0.99750...", FUNC(jn) (0, 0.1), 0.99750156206604003228);
+ check ("jn (0, 0.7) = 0.88120...", FUNC(jn) (0, 0.7), 0.88120088860740528084);
+ check ("jn (0, 1.0) = 0.76519...", FUNC(jn) (0, 1.0), 0.76519768655796655145);
+ check ("jn (0, 1.5) = 0.51182...", FUNC(jn) (0, 1.5), 0.51182767173591812875);
+ check_eps ("jn (0, 2.0) = 0.22389...", FUNC(jn) (0, 2.0), 0.22389077914123566805,
+ CHOOSE(0, 3e-17, 1.5e-8));
+ check_eps ("jn (0, 8.0) = 0.17165...", FUNC(jn) (0, 8.0), 0.17165080713755390609,
+ CHOOSE(0, 0, 1.5e-8));
+ check_eps ("jn (0, 10.0) = -0.24593...", FUNC(jn) (0, 10.0), -0.24593576445134833520,
+ CHOOSE(0, 6e-17, 1.5e-8));
+
+ /* jn (1, x) == j1 (x) */
+ check_isnan ("jn (1, NaN) = NaN", FUNC(jn) (1, nan_value));
+ check ("jn (1, +Inf) = 0", FUNC(jn) (1, plus_infty), 0);
+
+ check ("jn (1, -1.0) = -0.44005...", FUNC(jn) (1, -1.0), -0.44005058574493351596);
+ check ("jn (1, 0.0) = 0", FUNC(jn) (1, 0.0), 0.0);
+ check ("jn (1, 0.1) = 0.049937...", FUNC(jn) (1, 0.1), 0.049937526036241997556);
+ check ("jn (1, 0.7) = 0.32899...", FUNC(jn) (1, 0.7), 0.32899574154005894785);
+ check ("jn (1, 1.0) = 0.44005...", FUNC(jn) (1, 1.0), 0.44005058574493351596);
+ check ("jn (1, 1.5) = 0.55793...", FUNC(jn) (1, 1.5), 0.55793650791009964199);
+ check_eps ("jn (1, 2.0) = 0.57672...", FUNC(jn) (1, 2.0), 0.57672480775687338720,
+ CHOOSE(0, 2e-16, 0));
+ check_eps ("jn (1, 8.0) = 0.23463...", FUNC(jn) (1, 8.0), 0.23463634685391462438,
+ CHOOSE(0, 0, 1.5e-8));
+ check_eps ("jn (1, 10.0) = 0.04347...", FUNC(jn) (1, 10.0), 0.043472746168861436670,
+ CHOOSE(0, 7e-18, 3.8e-9));
+
+ /* jn (3, x) */
+ check_isnan ("jn (3, NaN) = NaN", FUNC(jn) (3, nan_value));
+ check ("jn (3, +Inf) = 0", FUNC(jn) (3, plus_infty), 0);
+
+ check ("jn (3, -1.0) = -0.01956...", FUNC(jn) (3, -1.0), -0.019563353982668405919);
+ check ("jn (3, 0.0) = 0", FUNC(jn) (3, 0.0), 0.0);
+ check_eps ("jn (3, 0.1) = 2.082...*10^-6", FUNC(jn) (3, 0.1), 0.000020820315754756261429,
+ CHOOSE(0, 4e-21, 0));
+ check_eps ("jn (3, 0.7) = 0.00692...", FUNC(jn) (3, 0.7), 0.0069296548267508408077,
+ CHOOSE(0, 2e-18, 0));
+ check ("jn (3, 1.0) = 0.01956...", FUNC(jn) (3, 1.0), 0.019563353982668405919);
+ check_eps ("jn (3, 2.0) = 0.12894...", FUNC(jn) (3, 2.0), 0.12894324947440205110,
+ CHOOSE(0, 3e-17, 0));
+ check_eps ("jn (3, 10.0) = 0.05837...", FUNC(jn) (3, 10.0), 0.058379379305186812343,
+ CHOOSE(0, 3e-17, 4e-9));
+
+ /* jn (10, x) */
+ check_isnan ("jn (10, NaN) = NaN", FUNC(jn) (10, nan_value));
+ check ("jn (10, +Inf) = 0", FUNC(jn) (10, plus_infty), 0);
+
+ check_eps ("jn (10, -1.0) = 2.6306...*10^-10", FUNC(jn) (10, -1.0), 0.26306151236874532070e-9,
+ CHOOSE(0, 0, 3e-17));
+ check ("jn (10, 0) = 0", FUNC(jn) (10, 0.0), 0.0);
+ check_eps ("jn (10, 0.1) = 2.6905...*10^-20", FUNC(jn) (10, 0.1), 0.26905328954342155795e-19,
+ CHOOSE(0, 2e-35, 2e-27));
+ check_eps ("jn (10, 0.7) = 7.517...*10^-12", FUNC(jn) (10, 0.7), 0.75175911502153953928e-11,
+ CHOOSE(0, 7e-27, 9e-19));
+ check_eps ("jn (10, 1.0) = 2.630...*10^-11", FUNC(jn) (10, 1.0), 0.26306151236874532070e-9,
+ CHOOSE(0, 0, 3e-17));
+ check_eps ("jn (10, 2.0) = 2.515...*10^-7", FUNC(jn) (10, 2.0), 0.25153862827167367096e-6,
+ CHOOSE(0, 2e-22, 0));
+ check_eps ("jn (10, 10.0) = 0.20748...", FUNC(jn) (10, 10.0), 0.20748610663335885770,
+ CHOOSE(0, 2e-16, 3e-8));
+}
static void
y0_test (void)
@@ -5564,6 +5642,7 @@ y0_test (void)
check_isinfn ("y0 (-1.0) = -inf", FUNC(y0) (-1.0));
check_isinfn ("y0 (0) = -inf", FUNC(y0) (0.0));
check_isnan ("y0 (NaN) = NaN", FUNC(y0) (nan_value));
+ check ("y0 (+Inf) = 0", FUNC(y0) (plus_infty), 0);
check_eps ("y0 (0.1) = -1.53423...", FUNC(y0) (0.1), -1.5342386513503668441,
CHOOSE(0, 3e-16, 1.2e-7));
@@ -5594,6 +5673,7 @@ y1_test (void)
/* y1 is the Bessel function of the second kind of order 1 */
check_isinfn ("y1 (-1.0) = -inf", FUNC(y1) (-1.0));
check_isinfn ("y1 (0) = -inf", FUNC(y1) (0.0));
+ check ("y1 (+Inf) = 0", FUNC(y1) (plus_infty), 0);
check_isnan ("y1 (NaN) = NaN", FUNC(y1) (nan_value));
check_eps ("y1 (0.1) = -6.45895...", FUNC(y1) (0.1), -6.4589510947020269877,
@@ -5611,6 +5691,89 @@ y1_test (void)
CHOOSE(0, 9e-17, 3.0e-8));
}
+static void
+yn_test (void)
+{
+ errno = 0;
+ FUNC(yn) (1, 1);
+ if (errno == ENOSYS)
+ /* Function not implemented. */
+ return;
+
+ /* yn is the Bessel function of the second kind of order n */
+
+ /* yn (0, x) == y0 (x) */
+ check_isinfn ("yn (0, -1.0) = -inf", FUNC(yn) (0, -1.0));
+ check_isinfn ("yn (0, 0) = -inf", FUNC(yn) (0, 0.0));
+ check_isnan ("yn (0, NaN) = NaN", FUNC(yn) (0, nan_value));
+ check ("yn (0, +Inf) = 0", FUNC(yn) (0, plus_infty), 0);
+
+ check_eps ("yn (0, 0.1) = -1.53423...", FUNC(yn) (0, 0.1), -1.5342386513503668441,
+ CHOOSE(0, 3e-16, 3e-7));
+ check_eps ("yn (0, 0.7) = -0.19066...", FUNC(yn) (0, 0.7), -0.19066492933739506743,
+ CHOOSE(0, 6e-17, 2e-8));
+ check_eps ("yn (0, 1.0) = 0.08825...", FUNC(yn) (0, 1.0), 0.088256964215676957983,
+ CHOOSE(0, 2e-17, 8e-9));
+ check_eps ("yn (0, 1.5) = 0.38244...", FUNC(yn) (0, 1.5), 0.38244892379775884396,
+ CHOOSE(0, 6e-17, 3e-8));
+ check_eps ("yn (0, 2.0) = 0.51037...", FUNC(yn) (0, 2.0), 0.51037567264974511960,
+ CHOOSE(0, 2e-16, 0));
+ check_eps ("yn (0, 8.0) = 0.22352...", FUNC(yn) (0, 8.0), 0.22352148938756622053,
+ CHOOSE(0, 3e-17, 1.5e-8));
+ check_eps ("yn (0, 10.0) = 0.05567...", FUNC(yn) (0, 10.0), 0.055671167283599391424,
+ CHOOSE(0, 0, 3.8e-8));
+
+ /* yn (1, x) == y1 (x) */
+ check_isinfn ("yn (1, -1.0) = -inf", FUNC(yn) (1, -1.0));
+ check_isinfn ("yn (1, 0) = -inf", FUNC(yn) (1, 0.0));
+ check ("yn (1, +Inf) = 0", FUNC(yn) (1, plus_infty), 0);
+ check_isnan ("yn (1, NaN) = NaN", FUNC(yn) (1, nan_value));
+
+ check_eps ("yn (1, 0.1) = -6.45895...", FUNC(yn) (1, 0.1), -6.4589510947020269877,
+ CHOOSE(0, 9e-16, 5e-7));
+ check_eps ("yn (1, 0.7) = -1.10324...", FUNC(yn) (1, 0.7), -1.1032498719076333697,
+ CHOOSE(0, 3e-16, 0));
+ check_eps ("yn (1, 1.0) = -0.78121...", FUNC(yn) (1, 1.0), -0.78121282130028871655,
+ CHOOSE(0, 2e-16, 0));
+ check ("yn (1, 1.5) = -0.41230...", FUNC(yn) (1, 1.5), -0.41230862697391129595);
+ check_eps ("yn (1, 2.0) = -0.10703...", FUNC(yn) (1, 2.0), -0.10703243154093754689,
+ CHOOSE(0, 2e-17, 2e-8));
+ check_eps ("yn (1, 8.0) = -0.15806...", FUNC(yn) (1, 8.0), -0.15806046173124749426,
+ CHOOSE(0, 0, 3e-8));
+ check_eps ("yn (1, 10.0) = 0.24901...", FUNC(yn) (1, 10.0), 0.24901542420695388392,
+ CHOOSE(0, 9e-17, 3e-8));
+
+ /* yn (3, x) */
+ check ("yn (3, +Inf) = 0", FUNC(yn) (3, plus_infty), 0);
+ check_isnan ("yn (3, NaN) = NaN", FUNC(yn) (3, nan_value));
+
+ check_eps ("yn (3, 0.1) = -5099.3...", FUNC(yn) (3, 0.1), -5099.3323786129048894,
+ CHOOSE(0, 1e-12, 5e-4));
+ check_eps ("yn (3, 0.7) = -15.819...", FUNC(yn) (3, 0.7), -15.819479052819633505,
+ CHOOSE(0, 4e-15, 0));
+ check ("yn (3, 1.0) = -5.8215...", FUNC(yn) (3, 1.0), -5.8215176059647288478);
+ check_eps ("yn (3, 2.0) = -1.1277...", FUNC(yn) (3, 2.0), -1.1277837768404277861,
+ CHOOSE(0, 3e-16, 0));
+ check_eps ("yn (3, 10.0) = -0.25136...", FUNC(yn) (3, 10.0), -0.25136265718383732978,
+ CHOOSE(0, 6e-17, 3e-8));
+
+ /* yn (10, x) */
+ check ("yn (10, +Inf) = 0", FUNC(yn) (10, plus_infty), 0);
+ check_isnan ("yn (10, NaN) = NaN", FUNC(yn) (10, nan_value));
+
+ check_eps ("yn (10, 0.1) = -1.183...*10^18", FUNC(yn) (10, 0.1), -0.11831335132045197885e19,
+ CHOOSE(0, 6e2, 2e11));
+ check_eps ("yn (10, 0.7) = -4.244...*10^9", FUNC(yn) (10, 0.7), -0.42447194260703866924e10,
+ CHOOSE(0, 3e-6, 6e2));
+ check_eps ("yn (10, 1.0) = -1.216...*10^8", FUNC(yn) (10, 1.0), -0.12161801427868918929e9,
+ CHOOSE(0, 0, 9));
+ check_eps ("yn (10, 2.0) = -129184.5...", FUNC(yn) (10, 2.0), -129184.54220803928264,
+ CHOOSE(0, 3e-11, 8e-3));
+ check_eps ("yn (10, 10.0) = -0.35981...", FUNC(yn) (10, 10.0), -0.35981415218340272205,
+ CHOOSE(0, 6e-17, 3e-8));
+
+}
+
/* Tests for the comparison macros */
typedef enum { is_less, is_equal, is_greater, is_unordered } comp_result;
@@ -6112,8 +6275,10 @@ main (int argc, char *argv[])
/* Bessel functions */
j0_test ();
j1_test ();
+ jn_test ();
y0_test ();
y1_test ();
+ yn_test ();
/* special tests */
identities ();