summaryrefslogtreecommitdiff
path: root/tests/tfrac.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2009-09-18 11:09:03 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2009-09-18 11:09:03 +0000
commit06a8bd7cdf4a630031d20ff1c7273704b9b4eae2 (patch)
tree65929f794cd403d109958938d6c0f7401cd67e45 /tests/tfrac.c
parent03628de7db52919ac197c33c2f259bb210970eb2 (diff)
downloadmpfr-06a8bd7cdf4a630031d20ff1c7273704b9b4eae2.tar.gz
tests/tfrac.c: added testcase for bug in mpfr_frac.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6453 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfrac.c')
-rw-r--r--tests/tfrac.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/tfrac.c b/tests/tfrac.c
index 5c8151c0d..a09807813 100644
--- a/tests/tfrac.c
+++ b/tests/tfrac.c
@@ -172,6 +172,28 @@ special (void)
mpfr_clear (t);
}
+static void
+bug20090918 (void)
+{
+ mpfr_t x, y;
+ mp_limb_t y0;
+
+ mpfr_init2 (x, 53);
+ mpfr_init2 (y, 13);
+ mpfr_set_str (x, "61680.352935791015625", 10, MPFR_RNDN);
+ mpfr_frac (y, x, MPFR_RNDZ);
+ y0 = MPFR_MANT(y)[0];
+ while ((y0 >> 1) << 1 == y0)
+ y0 >>= 1;
+ if (y0 > 0x2000)
+ {
+ printf ("Error in bug20090918 (significand has more than 13 bits).\n");
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
#define TEST_FUNCTION mpfr_frac
#include "tgeneric.c"
@@ -227,6 +249,8 @@ main (void)
mpfr_clear (ip);
mpfr_clear (fp);
+ bug20090918 ();
+
test_generic (2, 1000, 10);
tests_end_mpfr ();