summaryrefslogtreecommitdiff
path: root/tests/tli2.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-10-13 06:37:15 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-10-13 06:37:15 +0000
commit27b6d7edab02ec27ef3ccf36b7ba1c2b4920c85c (patch)
tree2875d2e730541ab836539d140a540c65421ae024 /tests/tli2.c
parentc36b71dfaf2b70aa2c958657ee3746eb0bc49bd9 (diff)
downloadmpfr-27b6d7edab02ec27ef3ccf36b7ba1c2b4920c85c.tar.gz
[li2.c] fixed bug when x is near 0
[tli2.c] added new test git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6512 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tli2.c')
-rw-r--r--tests/tli2.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/tli2.c b/tests/tli2.c
index cfc159758..f7f7ff4da 100644
--- a/tests/tli2.c
+++ b/tests/tli2.c
@@ -147,11 +147,41 @@ normal (void)
mpfr_clear (y);
}
+static void
+bug20091013 (void)
+{
+ mpfr_t x, y;
+ int inex;
+
+ mpfr_init2 (x, 17);
+ mpfr_init2 (y, 2);
+ mpfr_set_str_binary (x, "0.10000000000000000E-16");
+ inex = mpfr_li2 (y, x, MPFR_RNDN);
+ if (mpfr_cmp_ui_2exp (y, 1, -17) != 0)
+ {
+ printf ("Error in bug20091013()\n");
+ printf ("expected 2^(-17)\n");
+ printf ("got ");
+ mpfr_dump (y);
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("Error in bug20091013()\n");
+ printf ("expected negative ternary value, got %d\n", inex);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
int
main (int argc, char *argv[])
{
tests_start_mpfr ();
+ bug20091013 ();
+
special ();
normal ();