summaryrefslogtreecommitdiff
path: root/tests/tzeta.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-09-13 15:11:11 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-09-13 15:11:11 +0000
commitb418be0441754cb5f6ae401ca24b67b8536312d8 (patch)
treee7c6eef85ead683120272d35b2c415f61dd6ac11 /tests/tzeta.c
parent957762bec377267086fe28a8c22ee7f1ae374283 (diff)
downloadmpfr-b418be0441754cb5f6ae401ca24b67b8536312d8.tar.gz
[src/zeta.c] Added a FIXME: bug in the error computation due to the
use of the native double C type, which can yield an overflow. [tests/tzeta.c] Added a corresponding test case, which gives an assertion failure. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10865 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tzeta.c')
-rw-r--r--tests/tzeta.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/tzeta.c b/tests/tzeta.c
index 6bb292d1c..f1ad4138a 100644
--- a/tests/tzeta.c
+++ b/tests/tzeta.c
@@ -240,6 +240,7 @@ main (int argc, char *argv[])
mpfr_t s, y, z;
mpfr_prec_t prec;
mpfr_rnd_t rnd_mode;
+ mpfr_flags_t flags;
int inex;
tests_start_mpfr ();
@@ -453,6 +454,24 @@ main (int argc, char *argv[])
}
}
+ /* The following test yields an overflow in the error computation.
+ With r10864, this is detected and one gets an assertion failure. */
+ mpfr_set_prec (s, 1025);
+ mpfr_set_si_2exp (s, -1, 1024, MPFR_RNDN);
+ mpfr_nextbelow (s); /* -(2^1024 + 1) */
+ mpfr_clear_flags ();
+ inex = mpfr_zeta (z, s, MPFR_RNDN);
+ flags = __gmpfr_flags;
+ if (flags != (MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT) ||
+ ! mpfr_inf_p (z) || MPFR_IS_POS (z) || inex >= 0)
+ {
+ printf ("Error in mpfr_zeta for s = -(2^1024 + 1)\nGot ");
+ mpfr_dump (z);
+ printf ("with inex = %d and flags =", inex);
+ flags_out (flags);
+ exit (1);
+ }
+
mpfr_clear (s);
mpfr_clear (y);
mpfr_clear (z);