From 043a589e04950f2c7fad8afdcd6d91dbf2e7c542 Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Tue, 6 Sep 2016 13:09:02 +0200 Subject: [PATCH] fix aliasing issue in acb_hypgeom_gamma_lower --- acb_hypgeom/gamma_lower.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/acb_hypgeom/gamma_lower.c b/acb_hypgeom/gamma_lower.c index 73cfaa24..d56c4dab 100644 --- a/acb_hypgeom/gamma_lower.c +++ b/acb_hypgeom/gamma_lower.c @@ -14,7 +14,7 @@ void acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized, slong prec) { - acb_t s1, nz, t; + acb_t s1, nz, t, u; if (!acb_is_finite(s) || !acb_is_finite(z)) { @@ -25,6 +25,7 @@ acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized acb_init(s1); acb_init(nz); acb_init(t); + acb_init(u); acb_add_ui(s1, s, 1, prec); acb_neg(nz, z); @@ -32,17 +33,17 @@ acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized if (regularized == 0) { /* \gamma(s, z) = s^-1 z^s 1F1(s, 1+s, -z) */ - acb_hypgeom_m(res, s, s1, nz, 0, prec); + acb_hypgeom_m(u, s, s1, nz, 0, prec); acb_pow(t, z, s, prec); - acb_mul(res, res, t, prec); - acb_div(res, res, s, prec); + acb_mul(u, u, t, prec); + acb_div(res, u, s, prec); } else if (regularized == 1) { /* P(s, z) = z^s \gamma^{*}(s, z) */ - acb_hypgeom_m(res, s, s1, nz, 1, prec); + acb_hypgeom_m(u, s, s1, nz, 1, prec); acb_pow(t, z, s, prec); - acb_mul(res, res, t, prec); + acb_mul(res, u, t, prec); } else if (regularized == 2) { @@ -53,4 +54,6 @@ acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_t z, int regularized acb_clear(s1); acb_clear(nz); acb_clear(t); + acb_clear(u); } +