From 85016208f0754bdbcd8ed6bc4a6d82903f739064 Mon Sep 17 00:00:00 2001 From: vlefevre Date: Tue, 27 Nov 2018 13:17:11 +0000 Subject: [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 --- tests/tdiv.c | 17 ++++++++++++++--- 1 file 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); -- cgit v1.2.1