From 103b286455bfb64dd5e8401ef7f80f5bdeb1bfe8 Mon Sep 17 00:00:00 2001 From: zimmerma Date: Tue, 11 Sep 2018 09:37:07 +0000 Subject: [tests/tsqrt.c] modified test_sqrt1n() so that it passes with 8-bit limbs git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13169 280ebfd0-de03-0410-8827-d642c229c3f4 --- tests/tsqrt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/tsqrt.c b/tests/tsqrt.c index b6704ddf3..6b91801ca 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -661,14 +661,22 @@ test_sqrt1n (void) mpfr_t r, u; int inex; + MPFR_ASSERTD(GMP_NUMB_BITS >= 8); /* so that 15^2 is exactly representable */ + mpfr_init2 (r, GMP_NUMB_BITS); mpfr_init2 (u, GMP_NUMB_BITS); - inex = mpfr_set_ui_2exp (u, 17 * 17, 2 * GMP_NUMB_BITS - 10, MPFR_RNDN); + inex = mpfr_set_ui_2exp (u, 9 * 9, 2 * GMP_NUMB_BITS - 10, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + inex = mpfr_sqrt (r, u, MPFR_RNDN); + MPFR_ASSERTN(inex == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 9, GMP_NUMB_BITS - 5) == 0); + + inex = mpfr_set_ui_2exp (u, 15 * 15, 2 * GMP_NUMB_BITS - 10, MPFR_RNDN); MPFR_ASSERTN(inex == 0); inex = mpfr_sqrt (r, u, MPFR_RNDN); MPFR_ASSERTN(inex == 0); - MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 17, GMP_NUMB_BITS - 5) == 0); + MPFR_ASSERTN(mpfr_cmp_ui_2exp (r, 15, GMP_NUMB_BITS - 5) == 0); inex = mpfr_set_ui_2exp (u, 1, GMP_NUMB_BITS - 2, MPFR_RNDN); MPFR_ASSERTN(inex == 0); -- cgit v1.2.1