From 0f0d3c8b39784f5ce2c477e09b2e207fcee11255 Mon Sep 17 00:00:00 2001 From: Marc Mezzarobba Date: Sat, 13 Jan 2018 20:13:55 +0100 Subject: [PATCH] legendre_p_ui_root: simplify failure test as a micro-optimization, because the call to arb_contains could be comparatively costly for small n --- arb_hypgeom/legendre_p_ui_root.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arb_hypgeom/legendre_p_ui_root.c b/arb_hypgeom/legendre_p_ui_root.c index c550e38a..ba82e2cf 100644 --- a/arb_hypgeom/legendre_p_ui_root.c +++ b/arb_hypgeom/legendre_p_ui_root.c @@ -203,7 +203,7 @@ arb_hypgeom_legendre_p_ui_root(arb_t res, arb_t weight, ulong n, ulong k, slong arb_div(t, t, u, wp); arb_sub(v, v, t, wp); - if (!arb_contains(v0, v)) + if (mag_cmp(arb_radref(v), arb_radref(res)) >= 0) { /* flint_printf("unexpected Newton iteration failure...\n"); */ break;