summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-11-27 13:17:11 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-11-27 13:17:11 +0000
commit85016208f0754bdbcd8ed6bc4a6d82903f739064 (patch)
tree1c1f95660ae3718c08df36d75aa5ab84a782888e
parent8bd1c1d1a96af0cfb1d45439d3efe49667e4d633 (diff)
downloadmpfr-85016208f0754bdbcd8ed6bc4a6d82903f739064.tar.gz
[tests/tdiv.c] Fixed test_20151023().
(merged changesets r13149,13151,13298 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13301 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tdiv.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 2b328c5f3..430064330 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -1129,8 +1129,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);
@@ -1152,7 +1154,16 @@ 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_equal_p (q, q0))
+ {
+ printf ("Error in test_20151023 for p=%ld, rnd=RNDN\n",
+ (long) 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);