diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tagm.c | 19 | ||||
-rw-r--r-- | tests/thypot.c | 15 |
2 files changed, 33 insertions, 1 deletions
diff --git a/tests/tagm.c b/tests/tagm.c index 835e4ed00..9b30104e1 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -53,6 +53,7 @@ static void check_large (void) { mpfr_t a, b, agm; + int inex; mpfr_init2 (a, 82); mpfr_init2 (b, 82); @@ -77,6 +78,24 @@ check_large (void) mpfr_set_str (b, "703.93543315330225238487279020523738740563816490895994499256063816906728642622316", 10, GMP_RNDN); mpfr_agm (agm, a, b, GMP_RNDN); + mpfr_set_prec (a, 18); + mpfr_set_prec (b, 70); + mpfr_set_prec (agm, 67); + mpfr_set_str_binary (a, "0.111001111100101000e8"); + mpfr_set_str_binary (b, "0.1101110111100100010100110000010111011011011100110100111001010100100001e10"); + inex = mpfr_agm (agm, a, b, GMP_RNDN); + mpfr_set_str_binary (b, "0.1111110010011101101100010101011011010010010000001010100011000110011e9"); + if (mpfr_cmp (agm, b)) + { + printf ("Error in mpfr_agm (1)\n"); + exit (1); + } + if (inex >= 0) + { + printf ("Wrong flag for mpfr_agm (1)\n"); + exit (1); + } + mpfr_clear (a); mpfr_clear (b); mpfr_clear (agm); diff --git a/tests/thypot.c b/tests/thypot.c index 26a7d30ff..b17e8c7a7 100644 --- a/tests/thypot.c +++ b/tests/thypot.c @@ -1,6 +1,6 @@ /* Test file for mpfr_hypot. -Copyright 2001, 2002, 2003 Free Software Foundation. +Copyright 2001, 2002, 2003, 2004 Free Software Foundation. Adapted from tarctan.c. This file is part of the MPFR Library. @@ -64,6 +64,19 @@ test_large (void) mpfr_set_str_binary (t, "0.11111001010011000001110110001101011100001000010010100E-1021"); mpfr_hypot (y, x, t, GMP_RNDN); + mpfr_set_prec (x, 240); + mpfr_set_prec (y, 22); + mpfr_set_prec (t, 2); + mpfr_set_str_binary (x, "0.100111011010010010110100000100000001100010011100110101101111111101011110111011011101010110100101111000111100010100110000100101011110111011100110100110100101110101101100011000001100000001111101110100100100011011011010110111100110010101000111e-7"); + mpfr_set_str_binary (y, "0.1111000010000011000111e-10"); + mpfr_hypot (t, x, y, GMP_RNDN); + mpfr_set_str_binary (y, "0.11E-7"); + if (mpfr_cmp (t, y)) + { + printf ("Error in mpfr_hypot (1)\n"); + exit (1); + } + mpfr_clear (x); mpfr_clear (y); mpfr_clear (z); |