diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-09-06 07:33:45 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-09-06 07:33:45 +0000 |
commit | 6b26752e22aa7d117c92934f97e653b6197ced14 (patch) | |
tree | 07be952d16d26acb602251218d52be876e104d81 | |
parent | ea72874013f061cefd89d8faacbf6e0f3523c73c (diff) | |
download | mpfr-6b26752e22aa7d117c92934f97e653b6197ced14.tar.gz |
[tests/tdiv.c] fixed test_20151023()
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13149 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tdiv.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c index 8f4929c4b..044941f8a 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -1139,8 +1139,10 @@ test_20151023 (void) /* generate a random divisor of p bits */ mpfr_urandomb (d, RANDS); - /* generate a random quotient of GMP_NUMB_BITS bits */ - mpfr_urandomb (q0, RANDS); + /* generate a random non-zero quotient of GMP_NUMB_BITS bits */ + do + mpfr_urandomb (q0, RANDS); + while (mpfr_zero_p (q0)); /* zero-pad the quotient to p bits */ inex = mpfr_prec_round (q0, p, MPFR_RNDN); MPFR_ASSERTN(inex == 0); @@ -1162,7 +1164,15 @@ test_20151023 (void) MPFR_ASSERTN(inex == 0); mpfr_nextabove (n); mpfr_div (q, n, d, MPFR_RNDN); - MPFR_ASSERTN(mpfr_cmp (q, q0) == 0); + if (mpfr_cmp (q, q0) != 0) + { + printf ("Error in test_20151023 for p=%lu, rnd=RNDN\n", p); + printf ("n="); mpfr_dump (n); + printf ("d="); mpfr_dump (d); + printf ("expected q0="); mpfr_dump (q0); + printf ("got q="); mpfr_dump (q); + exit (1); + } inex = mpfr_mul (n, d, q0, MPFR_RNDN); MPFR_ASSERTN(inex == 0); |