summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-11 09:37:07 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-11 09:37:07 +0000
commit103b286455bfb64dd5e8401ef7f80f5bdeb1bfe8 (patch)
tree30abfcc9782a59e64903430e13380aaf1d69f72d
parent5c89232d76a99e6ae73674abf563f2427925a36e (diff)
downloadmpfr-103b286455bfb64dd5e8401ef7f80f5bdeb1bfe8.tar.gz
[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
-rw-r--r--tests/tsqrt.c12
1 files 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);