summaryrefslogtreecommitdiff
path: root/tests/tget_ld_2exp.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-09-14 13:10:57 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2009-09-14 13:10:57 +0000
commit88046b7b824d09181998991a7dcdfa9b0b7a5144 (patch)
treee522e822f63fb8ed2a9026981f5a1c72b5480c42 /tests/tget_ld_2exp.c
parentb1f0db5a06da43609d68678ea313ff79eb8a3cec (diff)
downloadmpfr-88046b7b824d09181998991a7dcdfa9b0b7a5144.tar.gz
[get_ld.c] fixed bug reported by Nelson Beebe
https://sympa.inria.fr/sympa/arc/mpfr/2009-05/msg00061.html git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6418 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tget_ld_2exp.c')
-rw-r--r--tests/tget_ld_2exp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tget_ld_2exp.c b/tests/tget_ld_2exp.c
index 141c9ccdf..2cb83d712 100644
--- a/tests/tget_ld_2exp.c
+++ b/tests/tget_ld_2exp.c
@@ -106,6 +106,29 @@ check_inf_nan (void)
#endif
}
+static void
+bug20090520 (void)
+{
+ mpfr_t x;
+ long double d, e;
+ int i;
+
+ mpfr_init (x);
+ mpfr_set_ui (x, 1, MPFR_RNDN);
+ d = 1.0;
+ mpfr_div_2exp (x, x, 16383, MPFR_RNDN);
+ for (i = 0; i < 16383; i++)
+ d *= 0.5;
+ e = mpfr_get_ld (x, MPFR_RNDN);
+ if (e != d)
+ {
+ printf ("mpfr_get_ld(1e-16383) failed\n");
+ printf ("expected %La\n", d);
+ printf ("got %La\n", e);
+ exit (1);
+ }
+ mpfr_clear (x);
+}
int
main (void)
@@ -113,6 +136,8 @@ main (void)
tests_start_mpfr ();
mpfr_test_init ();
+ bug20090520 ();
+
check_round ();
check_inf_nan ();