diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-12-19 14:45:00 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-12-19 14:45:00 +0000 |
commit | 272b507901846398aa13515972dbd01c6121d083 (patch) | |
tree | 65009a1c9ff46a5bc52f8a6d189e19b773844d57 /tests/tdiv.c | |
parent | 6bf00ecfa902749a1fa8fa266c2e5d1cc22d8a35 (diff) | |
download | mpfr-272b507901846398aa13515972dbd01c6121d083.tar.gz |
[tests/tdiv.c] Added new non-regression test: the was the real cause of
the ttanh failure in r11993 without the tanh.c fix in this same commit.
But this mpfr_div was fixed in r12002.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12016 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tdiv.c')
-rw-r--r-- | tests/tdiv.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c index 5b0bb04e6..0b16cd3a4 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -1457,6 +1457,30 @@ test_20170105 (void) mpfr_clears (x, y, z, t, (mpfr_ptr) 0); } +/* The real cause of the mpfr_ttanh failure from the non-regression test + added in tests/ttanh.c@11993 was actually due to a bug in mpfr_div, as + this can be seen by comparing the logs of the 3.1 branch and the trunk + r11992 with MPFR_LOG_ALL=1 MPFR_LOG_PREC=50 on this particular test + (this was noticed because adding this test to the 3.1 branch did not + yield a failure like in the trunk, though the mpfr_ttanh code did not + change until r11993). This was the bug actually fixed in r12002. +*/ +static void +test_20171219 (void) +{ + mpfr_t x, y, z, t; + + mpfr_inits2 (126, x, y, z, t, (mpfr_ptr) 0); + mpfr_set_str_binary (x, "0.111000000000000111100000000000011110000000000001111000000000000111100000000000011110000000000001111000000000000111100000000000E1"); + /* x = 36347266450315671364380109803814927 / 2^114 */ + mpfr_add_ui (y, x, 2, MPFR_RNDN); + /* y = 77885641318594292392624080437575695 / 2^114 */ + mpfr_div (z, x, y, MPFR_RNDN); + mpfr_set_ui_2exp (t, 3823, -13, MPFR_RNDN); + MPFR_ASSERTN (mpfr_equal_p (z, t)); + mpfr_clears (x, y, z, t, (mpfr_ptr) 0); +} + #if !defined(MPFR_GENERIC_ABI) && GMP_NUMB_BITS == 64 /* exercise mpfr_div2_approx */ static void @@ -1526,6 +1550,7 @@ main (int argc, char *argv[]) test_20151023 (); test_20160831 (); test_20170104 (); + test_20171219 (); test_generic (MPFR_PREC_MIN, 800, 50); test_bad (); test_extreme (); |