From 450435a84a40acc1871cd84f1caf2ea47c11a18c Mon Sep 17 00:00:00 2001
From: fredrik <fredrik.johansson@gmail.com>
Date: Tue, 28 Sep 2021 12:07:45 +0200
Subject: [PATCH] fix (hopefully) spurious test failures for gamma_fmpq

---
 arb_hypgeom/gamma_fmpq.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arb_hypgeom/gamma_fmpq.c b/arb_hypgeom/gamma_fmpq.c
index 996a87e5..ee750d0d 100644
--- a/arb_hypgeom/gamma_fmpq.c
+++ b/arb_hypgeom/gamma_fmpq.c
@@ -529,22 +529,22 @@ arb_hypgeom_gamma_fmpq_outward(arb_t y, const fmpq_t x, slong prec)
 
     if (q == 1 || q == 2 || q == 3 || q == 4 || q == 6)
     {
-        arb_hypgeom_gamma_small_frac(t, p, q, prec);
+        arb_hypgeom_gamma_small_frac(t, p, q, prec + 4 * (m != 0));
     }
     else
     {
-        arb_hypgeom_gamma_fmpq_hyp(t, a, prec);
+        arb_hypgeom_gamma_fmpq_hyp(t, a, prec + 4 * (m != 0));
     }
 
     /* argument reduction */
     if (m >= 0)
     {
-        arb_rising_fmpq_ui(u, a, m, prec);
+        arb_rising_fmpq_ui(u, a, m, prec + 4);
         arb_mul(y, t, u, prec);
     }
     else
     {
-        arb_rising_fmpq_ui(u, x, -m, prec);
+        arb_rising_fmpq_ui(u, x, -m, prec + 4);
         arb_div(y, t, u, prec);
     }
 
@@ -602,7 +602,7 @@ arb_hypgeom_gamma_fmpq_taylor(arb_t y, const fmpq_t x, slong prec)
     }
 
     arb_set_fmpq(t, a, prec + 4);
-    success = arb_hypgeom_gamma_taylor(t, t, 0, prec);
+    success = arb_hypgeom_gamma_taylor(t, t, 0, prec + 4);
 
     if (success)
     {
@@ -611,12 +611,12 @@ arb_hypgeom_gamma_fmpq_taylor(arb_t y, const fmpq_t x, slong prec)
 
         if (m >= 0)
         {
-            arb_rising_fmpq_ui(u, a, m, prec);
+            arb_rising_fmpq_ui(u, a, m, prec + 4);
             arb_mul(y, t, u, prec);
         }
         else
         {
-            arb_rising_fmpq_ui(u, x, -m, prec);
+            arb_rising_fmpq_ui(u, x, -m, prec + 4);
             arb_div(y, t, u, prec);
         }
 
@@ -684,7 +684,7 @@ arb_hypgeom_gamma_fmpq(arb_t y, const fmpq_t x, slong prec)
         wp = (slong) fmpz_bits(fmpq_numref(x)) - (slong) fmpz_bits(fmpq_denref(x));
         wp = FLINT_MAX(wp, 0);
         wp = FLINT_MIN(wp, 4 * prec);
-        wp += prec;
+        wp += prec + 4;
 
         arb_set_fmpq(y, x, wp);
 
