diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-07-20 16:11:15 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-07-20 16:11:15 +0000 |
commit | bd51be6f206ac602e8e2682b72b05a02416f2eb0 (patch) | |
tree | ac6ccf8a4cb0217e5ee20fe07aea381da020fdf2 /tests | |
parent | 4e7a9de434990ad6cb497ab843787fcbea382f46 (diff) | |
download | mpfr-bd51be6f206ac602e8e2682b72b05a02416f2eb0.tar.gz |
Added code to check mpfr against Gonnet's tables when the environment variable
MPFR_CHECK_ALL is defined (some table entries were checked by MuPAD)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4688 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tacos.c | 5 | ||||
-rw-r--r-- | tests/tacosh.c | 3 | ||||
-rw-r--r-- | tests/tasin.c | 3 | ||||
-rw-r--r-- | tests/tasinh.c | 3 | ||||
-rw-r--r-- | tests/tatan.c | 3 | ||||
-rw-r--r-- | tests/tatanh.c | 3 | ||||
-rw-r--r-- | tests/tcos.c | 3 | ||||
-rw-r--r-- | tests/tcosh.c | 3 | ||||
-rw-r--r-- | tests/terf.c | 6 | ||||
-rw-r--r-- | tests/texp.c | 3 | ||||
-rw-r--r-- | tests/texp2.c | 3 | ||||
-rw-r--r-- | tests/tgamma.c | 3 | ||||
-rw-r--r-- | tests/tj0.c | 3 | ||||
-rw-r--r-- | tests/tj1.c | 3 | ||||
-rw-r--r-- | tests/tlgamma.c | 11 | ||||
-rw-r--r-- | tests/tlog.c | 3 | ||||
-rw-r--r-- | tests/tlog10.c | 3 | ||||
-rw-r--r-- | tests/tmul.c | 16 | ||||
-rw-r--r-- | tests/tpow.c | 16 | ||||
-rw-r--r-- | tests/tsin.c | 3 | ||||
-rw-r--r-- | tests/tsinh.c | 3 | ||||
-rw-r--r-- | tests/tsqrt.c | 3 | ||||
-rw-r--r-- | tests/ttan.c | 3 | ||||
-rw-r--r-- | tests/ttanh.c | 3 | ||||
-rw-r--r-- | tests/tui_div.c | 10 | ||||
-rw-r--r-- | tests/ty0.c | 3 | ||||
-rw-r--r-- | tests/ty1.c | 3 |
27 files changed, 125 insertions, 2 deletions
diff --git a/tests/tacos.c b/tests/tacos.c index 8c4f166e1..5d3177a06 100644 --- a/tests/tacos.c +++ b/tests/tacos.c @@ -176,11 +176,12 @@ main (void) test_generic (2, 100, 7); - data_check ("data/acos", mpfr_acos, "mpfr_acos"); - mpfr_clear (x); mpfr_clear (y); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/acos", mpfr_acos, "mpfr_acos"); + tests_end_mpfr (); return 0; } diff --git a/tests/tacosh.c b/tests/tacosh.c index c5915ddda..b4f4e6772 100644 --- a/tests/tacosh.c +++ b/tests/tacosh.c @@ -132,6 +132,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 25); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/acosh", mpfr_acosh, "mpfr_acosh"); + tests_end_mpfr (); return 0; } diff --git a/tests/tasin.c b/tests/tasin.c index 29f6ef66a..1fdd9cc33 100644 --- a/tests/tasin.c +++ b/tests/tasin.c @@ -206,5 +206,8 @@ main (void) tests_end_mpfr (); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/asin", mpfr_asin, "mpfr_asin"); + return 0; } diff --git a/tests/tasinh.c b/tests/tasinh.c index a2acc6c2a..ff15833f2 100644 --- a/tests/tasinh.c +++ b/tests/tasinh.c @@ -140,6 +140,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 25); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/asinh", mpfr_asinh, "mpfr_asinh"); + tests_end_mpfr (); return 0; } diff --git a/tests/tatan.c b/tests/tatan.c index 10df18e96..ba8511bdd 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -387,6 +387,9 @@ main (int argc, char *argv[]) test_generic_atan2 (2, 200, 17); test_generic_atan2_neg (2, 200, 17); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/atan", mpfr_atan, "mpfr_atan"); + tests_end_mpfr (); return 0; } diff --git a/tests/tatanh.c b/tests/tatanh.c index 06921e243..0c146aa44 100644 --- a/tests/tatanh.c +++ b/tests/tatanh.c @@ -179,6 +179,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 25); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/atanh", mpfr_atanh, "mpfr_atanh"); + tests_end_mpfr (); return 0; } diff --git a/tests/tcos.c b/tests/tcos.c index 507fff8f4..4a983132d 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -360,6 +360,9 @@ main (int argc, char *argv[]) mpfr_clear (x); mpfr_clear (y); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/cos", mpfr_cos, "mpfr_cos"); + tests_end_mpfr (); return 0; } diff --git a/tests/tcosh.c b/tests/tcosh.c index cd9919680..f1ce72fc1 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -194,6 +194,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 100); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/cosh", mpfr_cosh, "mpfr_cosh"); + tests_end_mpfr (); return 0; } diff --git a/tests/terf.c b/tests/terf.c index 98b742036..847f0c00c 100644 --- a/tests/terf.c +++ b/tests/terf.c @@ -551,6 +551,12 @@ main (int argc, char *argv[]) test_generic_erf (2, 100, 15); test_generic_erfc (2, 100, 15); + if (getenv ("MPFR_CHECK_ALL") != NULL) + { + data_check ("data/erf", mpfr_erf, "mpfr_erf"); + data_check ("data/erfc", mpfr_erfc, "mpfr_erfc"); + } + tests_end_mpfr (); return 0; } diff --git a/tests/texp.c b/tests/texp.c index 9359438b4..addd5c161 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -642,6 +642,9 @@ main (int argc, char *argv[]) overflowed_exp0 (); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/exp", mpfr_exp, "mpfr_exp"); + tests_end_mpfr (); return 0; } diff --git a/tests/texp2.c b/tests/texp2.c index dadd0f651..6aaad33b3 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -350,6 +350,9 @@ main (int argc, char *argv[]) overflowed_exp2_0 (); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/exp2", mpfr_exp2, "mpfr_exp2"); + tests_end_mpfr (); return 0; } diff --git a/tests/tgamma.c b/tests/tgamma.c index 6bf21d7a3..b24751a2c 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -440,6 +440,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 2); gamma_integer (); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/gamma", mpfr_gamma, "mpfr_gamma"); + tests_end_mpfr (); return 0; } diff --git a/tests/tj0.c b/tests/tj0.c index de8880ab9..b7dea925d 100644 --- a/tests/tj0.c +++ b/tests/tj0.c @@ -95,6 +95,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 10); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/j0", mpfr_j0, "mpfr_j0"); + tests_end_mpfr (); return 0; diff --git a/tests/tj1.c b/tests/tj1.c index f2a636494..d0b68c0be 100644 --- a/tests/tj1.c +++ b/tests/tj1.c @@ -79,6 +79,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 10); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/j1", mpfr_j1, "mpfr_j1"); + tests_end_mpfr (); return 0; diff --git a/tests/tlgamma.c b/tests/tlgamma.c index 94604493b..55c5e851b 100644 --- a/tests/tlgamma.c +++ b/tests/tlgamma.c @@ -351,6 +351,14 @@ special (void) mpfr_clear (y); } +static int +mpfr_lgamma1 (mpfr_t y, mpfr_t x, mp_rnd_t r) +{ + int sign; + + return mpfr_lgamma (y, &sign, x, r); +} + int main (void) { @@ -359,6 +367,9 @@ main (void) special (); test_generic (2, 100, 2); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma"); + tests_end_mpfr (); return 0; } diff --git a/tests/tlog.c b/tests/tlog.c index 4d3329eb0..f08bcac67 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -327,6 +327,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 40); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/log", mpfr_log, "mpfr_log"); + done: tests_end_mpfr (); return 0; diff --git a/tests/tlog10.c b/tests/tlog10.c index cb9c6258a..c19780e02 100644 --- a/tests/tlog10.c +++ b/tests/tlog10.c @@ -114,6 +114,9 @@ main (int argc, char *argv[]) mpfr_clear (x); mpfr_clear (y); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/log10", mpfr_log10, "mpfr_log10"); + tests_end_mpfr (); return 0; } diff --git a/tests/tmul.c b/tests/tmul.c index 3b1440af4..0dd7685d7 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -641,6 +641,19 @@ check_regression (void) #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100) #include "tgeneric.c" +/* multiplies x by 53-bit approximation of Pi */ +static int +mpfr_mulpi (mpfr_t y, mpfr_t x, mp_rnd_t r) +{ + mpfr_t z; + int inex; + + mpfr_init2 (z, 53); + mpfr_set_str_binary (z, "11.001001000011111101101010100010001000010110100011"); + inex = mpfr_mul (y, x, z, r); + mpfr_clear (z); + return inex; +} int main (int argc, char *argv[]) @@ -683,6 +696,9 @@ main (int argc, char *argv[]) check_regression (); test_generic (2, 500, 100); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/mulpi", mpfr_mulpi, "mpfr_mulpi"); + tests_end_mpfr (); return 0; } diff --git a/tests/tpow.c b/tests/tpow.c index 47816bfc6..74adabaa9 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -862,6 +862,19 @@ overflows (void) mpfr_clear(b); } +static int +mpfr_pow275 (mpfr_t y, mpfr_t x, mp_rnd_t r) +{ + mpfr_t z; + int inex; + + mpfr_init2 (z, 4); + mpfr_set_ui_2exp (z, 11, -2, GMP_RNDN); + inex = mpfr_pow (y, x, z, GMP_RNDN); + mpfr_clear (z); + return inex; +} + int main (void) { @@ -885,6 +898,9 @@ main (void) test_generic_ui (2, 100, 100); test_generic_si (2, 100, 100); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/pow275", mpfr_pow275, "mpfr_pow275"); + tests_end_mpfr (); return 0; } diff --git a/tests/tsin.c b/tests/tsin.c index 2ed2bf61c..318a9cda4 100644 --- a/tests/tsin.c +++ b/tests/tsin.c @@ -360,6 +360,9 @@ main (int argc, char *argv[]) test_sign (); check_tiny (); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/sin", mpfr_sin, "mpfr_sin"); + tests_end_mpfr (); return 0; } diff --git a/tests/tsinh.c b/tests/tsinh.c index 56aa6ecd7..8a666c6eb 100644 --- a/tests/tsinh.c +++ b/tests/tsinh.c @@ -98,6 +98,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 100); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/sinh", mpfr_sinh, "mpfr_sinh"); + tests_end_mpfr (); return 0; } diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 12e47f02b..8f559773b 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -672,6 +672,9 @@ main (void) check4 ("72154663483843080704304789585920.0", GMP_RNDD, "1.e2d9a51977e6d@13"); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/sqrt", mpfr_sqrt, "mpfr_sqrt"); + tests_end_mpfr (); return 0; } diff --git a/tests/ttan.c b/tests/ttan.c index 85d4d762e..e3ce8c11c 100644 --- a/tests/ttan.c +++ b/tests/ttan.c @@ -155,6 +155,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 10); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/tan", mpfr_tan, "mpfr_tan"); + tests_end_mpfr (); return 0; } diff --git a/tests/ttanh.c b/tests/ttanh.c index b7304e09a..2426d472f 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -127,6 +127,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 100); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/tanh", mpfr_tanh, "mpfr_tanh"); + tests_end_mpfr (); return 0; } diff --git a/tests/tui_div.c b/tests/tui_div.c index 4adf26f8c..80cdbe7c9 100644 --- a/tests/tui_div.c +++ b/tests/tui_div.c @@ -160,6 +160,12 @@ check_nan (void) mpfr_clear (q); } +static int +mpfr_inv (mpfr_t y, mpfr_t x, mp_rnd_t r) +{ + return mpfr_ui_div (y, 1, x, r); +} + int main (int argc, char *argv[]) { @@ -178,6 +184,10 @@ main (int argc, char *argv[]) check(1476599377, "-2.14191393656148625995e+305", GMP_RNDD, "-6.8938315017943889615e-297"); + /* inv is for 1/x */ + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/inv", mpfr_inv, "mpfr_ui_div(1,x)"); + tests_end_mpfr (); return 0; } diff --git a/tests/ty0.c b/tests/ty0.c index f3ed484eb..5f09c9ea9 100644 --- a/tests/ty0.c +++ b/tests/ty0.c @@ -90,6 +90,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 1); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/y0", mpfr_y0, "mpfr_y0"); + tests_end_mpfr (); return 0; diff --git a/tests/ty1.c b/tests/ty1.c index 41c96264c..bec334ca0 100644 --- a/tests/ty1.c +++ b/tests/ty1.c @@ -90,6 +90,9 @@ main (int argc, char *argv[]) test_generic (2, 100, 1); + if (getenv ("MPFR_CHECK_ALL") != NULL) + data_check ("data/y1", mpfr_y1, "mpfr_y1"); + tests_end_mpfr (); return 0; |