summaryrefslogtreecommitdiff
path: root/tests/tsqrt.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-20 17:05:02 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-20 17:05:02 +0000
commit7fa7007d5457a6d5160c6296b2777065a2470707 (patch)
treecffc5543194062867ccd69de0883f04efb333b87 /tests/tsqrt.c
parent85346107a854a72600622fb82ccf4420af4bfe21 (diff)
downloadmpfr-7fa7007d5457a6d5160c6296b2777065a2470707.tar.gz
added test case for bug reported by Fredrik Johansson
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9857 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tsqrt.c')
-rw-r--r--tests/tsqrt.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/tsqrt.c b/tests/tsqrt.c
index 397f29d83..2f0e03b2f 100644
--- a/tests/tsqrt.c
+++ b/tests/tsqrt.c
@@ -568,6 +568,23 @@ test_property2 (mpfr_prec_t p, mpfr_rnd_t r)
mpfr_clear (y);
}
+/* bug reported by Fredrik Johansson */
+static void
+bug20160120 (void)
+{
+ mpfr_t x, y;
+
+ mpfr_init2 (x, 361);
+ mpfr_init2 (y, 64);
+
+ mpfr_set_str_binary (x, "0.111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111E0");
+ mpfr_sqrt (y, x, MPFR_RNDN);
+ MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0);
+
+ mpfr_clear(x);
+ mpfr_clear(y);
+}
+
#define TEST_FUNCTION test_sqrt
#define TEST_RANDOM_POS 8
#include "tgeneric.c"
@@ -703,6 +720,8 @@ main (void)
data_check ("data/sqrt", mpfr_sqrt, "mpfr_sqrt");
bad_cases (mpfr_sqrt, mpfr_sqr, "mpfr_sqrt", 8, -256, 255, 4, 128, 800, 50);
+ bug20160120 ();
+
tests_end_mpfr ();
return 0;
}