summaryrefslogtreecommitdiff
path: root/tests/tgamma.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2020-05-19 15:06:58 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2020-05-19 15:06:58 +0000
commit193eb3b7593414917cfb3e6323af9197427057b3 (patch)
tree3fb8297b766e50c97fbe138c122e76c8f8e2bdda /tests/tgamma.c
parent73c7ba5c6ae4ed415de9a615ff172b5c92385628 (diff)
downloadmpfr-193eb3b7593414917cfb3e6323af9197427057b3.tar.gz
added non-regression test for bug reported by Frithjof Blomquist
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13907 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgamma.c')
-rw-r--r--tests/tgamma.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/tgamma.c b/tests/tgamma.c
index e20a81e9b..c47a50aef 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -1055,6 +1055,35 @@ exp_lgamma_tests (void)
set_emax (emax);
}
+/* bug reported by Frithjof Blomquist on May 19, 2020 */
+static void
+bug20200519 (void)
+{
+ mpfr_prec_t prec = 25093;
+ mpfr_t x, y, z, d;
+ double dd;
+
+ mpfr_init2 (x, prec);
+ mpfr_init2 (y, prec);
+ mpfr_init2 (z, prec + 100);
+ mpfr_init2 (d, 24);
+ mpfr_set_d (x, 2.5, MPFR_RNDN);
+ mpfr_gamma (y, x, MPFR_RNDN);
+ mpfr_gamma (z, x, MPFR_RNDN);
+ mpfr_sub (d, y, z, MPFR_RNDN);
+ mpfr_mul_2si (d, d, prec - mpfr_get_exp (y), MPFR_RNDN);
+ dd = mpfr_get_d (d, MPFR_RNDN);
+ if (dd < -0.5 || 0.5 < dd)
+ {
+ printf ("Error in bug20200519: dd=%f\n", dd);
+ exit (1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+ mpfr_clear (z);
+ mpfr_clear (d);
+}
+
int
main (int argc, char *argv[])
{
@@ -1086,6 +1115,9 @@ main (int argc, char *argv[])
data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
+ /* this test takes about one minute */
+ bug20200519 ();
+
tests_end_mpfr ();
return 0;
}