From 3d62dc3382734986f27ee9434755d1109a633627 Mon Sep 17 00:00:00 2001 From: fredrik Date: Thu, 23 Sep 2021 20:26:00 +0200 Subject: [PATCH] small improvement for barnes_g --- acb/barnes_g.c | 7 +++++++ arb_fpwrap/fpwrap.c | 34 +++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/acb/barnes_g.c b/acb/barnes_g.c index 3bf96759..c531e766 100644 --- a/acb/barnes_g.c +++ b/acb/barnes_g.c @@ -108,6 +108,10 @@ acb_log_barnes_g(acb_t res, const acb_t z, slong prec) void acb_barnes_g(acb_t res, const acb_t z, slong prec) { + int real; + + real = acb_is_real(z); + if (acb_is_int(z)) { if (arb_is_nonpositive(acb_realref(z))) @@ -126,5 +130,8 @@ acb_barnes_g(acb_t res, const acb_t z, slong prec) _acb_log_barnes_g_zeta(res, z, prec); acb_exp(res, res, prec); + + if (real) + arb_zero(acb_imagref(res)); } diff --git a/arb_fpwrap/fpwrap.c b/arb_fpwrap/fpwrap.c index e4c0038f..4200b0f9 100644 --- a/arb_fpwrap/fpwrap.c +++ b/arb_fpwrap/fpwrap.c @@ -691,10 +691,7 @@ _arb_barnes_g(arb_t res, const arb_t x, slong prec) acb_init(u); acb_set_arb(t, x); acb_barnes_g(u, t, prec); - if (acb_is_real(u)) - arb_set(res, acb_realref(u)); - else - arb_indeterminate(res); + arb_set(res, acb_realref(u)); acb_clear(t); acb_clear(u); } @@ -702,17 +699,24 @@ _arb_barnes_g(arb_t res, const arb_t x, slong prec) static void _arb_log_barnes_g(arb_t res, const arb_t x, slong prec) { - acb_t t, u; - acb_init(t); - acb_init(u); - acb_set_arb(t, x); - acb_log_barnes_g(u, t, prec); - if (acb_is_real(u)) - arb_set(res, acb_realref(u)); - else + if (!arb_is_positive(x)) + { arb_indeterminate(res); - acb_clear(t); - acb_clear(u); + } + else + { + acb_t t, u; + acb_init(t); + acb_init(u); + acb_set_arb(t, x); + acb_log_barnes_g(u, t, prec); + if (acb_is_real(u)) + arb_set(res, acb_realref(u)); + else + arb_indeterminate(res); + acb_clear(t); + acb_clear(u); + } } DEF_DOUBLE_FUN_1(barnes_g, _arb_barnes_g) @@ -835,7 +839,7 @@ DEF_CDOUBLE_FUN_2(hermite_h, acb_hypgeom_hermite_h) /* todo: fresnel (with flags) */ /* todo: functions with multiple outputs */ /* todo: incomplete gamma, exp integrals... */ +/* todo: airy zeros */ /* legendre_p, legendre_q, +roots, spherharm */ /* todo: pfqs */ -