summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-10-28 09:02:45 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-10-28 09:02:45 +0000
commitb5fa9dd5cb6e5ccefc42db03db0090799529b160 (patch)
tree0c0b9c9eb56c342a56f5a2952f8e9f5780c51276
parent581061f7b6aa8ddf87b24e677142da289100d017 (diff)
downloadmpfr-b5fa9dd5cb6e5ccefc42db03db0090799529b160.tar.gz
[tests/tsum.c] Added test for bug reported by Joseph S. Myers:
https://sympa.inria.fr/sympa/arc/mpfr/2013-10/msg00015.html git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8697 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tsum.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/tsum.c b/tests/tsum.c
index bf180087e..76300b634 100644
--- a/tests/tsum.c
+++ b/tests/tsum.c
@@ -298,6 +298,41 @@ void check_special (void)
mpfr_clears (tab[0], tab[1], tab[2], r, (mpfr_ptr) 0);
}
+/* bug reported by Joseph S. Myers on 2013-10-27
+ https://sympa.inria.fr/sympa/arc/mpfr/2013-10/msg00015.html */
+static void
+bug20131027 (void)
+{
+ mpfr_t r, t[4];
+ mpfr_ptr p[4];
+ char *s[4] = {
+ "0x1p1000",
+ "-0x0.fffffffffffff80000000000000001p1000",
+ "-0x1p947",
+ "0x1p880"
+ };
+ int i;
+
+ mpfr_init2 (r, 53);
+ for (i = 0; i < 4; i++)
+ {
+ mpfr_init2 (t[i], i == 0 ? 53 : 1000);
+ mpfr_set_str (t[i], s[i], 0, MPFR_RNDN);
+ p[i] = t[i];
+ }
+ mpfr_sum (r, p, 4, MPFR_RNDN);
+
+ if (MPFR_NOTZERO (r))
+ {
+ printf ("mpfr_sum incorrect in bug20131027: expected 0, got\n");
+ mpfr_dump (r);
+ exit (1);
+ }
+
+ for (i = 0; i < 4; i++)
+ mpfr_clear (t[i]);
+ mpfr_clear (r);
+}
int
main (void)
@@ -308,6 +343,7 @@ main (void)
tests_start_mpfr ();
check_special ();
+ bug20131027 ();
test_sort (1764, 1026);
for (p = 2 ; p < 444 ; p += 17)
for (n = 2 ; n < 1026 ; n += 42 + p)