summaryrefslogtreecommitdiff
path: root/tests/tlog1p.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2006-08-14 22:23:01 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2006-08-14 22:23:01 +0000
commit452e19e6a64cfca7f2490829e48cce1f8a2f06ed (patch)
tree956a9dc446b05b1236f4c2589bae817bc8369ea0 /tests/tlog1p.c
parent6d17415673b6aa803a1421d96a6ceb49569e33db (diff)
downloadmpfr-452e19e6a64cfca7f2490829e48cce1f8a2f06ed.tar.gz
Fixed bug in log1p for small negative values of x and added testcase.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4114 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tlog1p.c')
-rw-r--r--tests/tlog1p.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/tlog1p.c b/tests/tlog1p.c
index 7d6b73abd..2bede57ef 100644
--- a/tests/tlog1p.c
+++ b/tests/tlog1p.c
@@ -88,12 +88,40 @@ special (void)
mpfr_clear (x);
}
+static void
+other (void)
+{
+ mpfr_t x, y;
+
+ /* Bug reported by Guillaume Melquiond on 2006-08-14. */
+ mpfr_init2 (x, 53);
+ mpfr_set_str (x, "-1.5e4f72873ed9a@-100", 16, GMP_RNDN);
+ mpfr_init2 (y, 57);
+ mpfr_log1p (y, x, GMP_RNDU);
+ if (mpfr_cmp (x, y) != 0)
+ {
+ printf ("Error in tlog1p for x = ");
+ mpfr_out_str (stdout, 16, 0, x, GMP_RNDN);
+ printf (", rnd = GMP_RNDU\nExpected ");
+ mpfr_out_str (stdout, 16, 15, x, GMP_RNDN);
+ printf ("\nGot ");
+ mpfr_out_str (stdout, 16, 15, y, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+
+ mpfr_clear (y);
+ mpfr_clear (x);
+ return;
+}
+
int
main (int argc, char *argv[])
{
tests_start_mpfr ();
special ();
+ other ();
test_generic (2, 100, 50);