diff --git a/acb/rsqrt.c b/acb/rsqrt.c index aa0e6e8f..9f8c86b9 100644 --- a/acb/rsqrt.c +++ b/acb/rsqrt.c @@ -22,15 +22,6 @@ arb_get_mag_reverse(mag_t res, const arb_t x) mag_clear(t); } -void -mag_add_ui_lower(mag_t res, const mag_t x, ulong y) -{ - mag_t t; - mag_init(t); - mag_set_ui_lower(t, y); /* no need to free */ - mag_add_lower(res, x, t); -} - /* upper bound for re(rsqrt(x+yi)) / |rsqrt(x+yi)|, given upper bound for x, lower bound for y */ void diff --git a/mag.h b/mag.h index 1e7a018a..300d30e7 100644 --- a/mag.h +++ b/mag.h @@ -294,6 +294,7 @@ void mag_add(mag_t z, const mag_t x, const mag_t y); void mag_add_lower(mag_t z, const mag_t x, const mag_t y); void mag_add_ui(mag_t z, const mag_t x, ulong y); +void mag_add_ui_lower(mag_t res, const mag_t x, ulong y); void mag_add_ui_2exp_si(mag_t z, const mag_t x, ulong y, slong e); diff --git a/mag/add_ui.c b/mag/add_ui.c index 449b04b3..4da504aa 100644 --- a/mag/add_ui.c +++ b/mag/add_ui.c @@ -20,4 +20,12 @@ mag_add_ui(mag_t y, const mag_t x, ulong k) mag_add(y, x, t); } +void +mag_add_ui_lower(mag_t res, const mag_t x, ulong k) +{ + mag_t t; + mag_init(t); + mag_set_ui_lower(t, k); /* no need to free */ + mag_add_lower(res, x, t); +} diff --git a/mag/root.c b/mag/root.c index a085db05..5635c2f0 100644 --- a/mag/root.c +++ b/mag/root.c @@ -38,6 +38,9 @@ mag_root(mag_t y, const mag_t x, ulong n) fmpz_init_set_ui(e, MAG_BITS); fmpz_init(f); + /* We evaluate exp(log(1+2^(kn)x)/n) 2^-k where k is chosen + so that 2^(kn) x ~= 2^30. TODO: this rewriting is probably + unnecessary with the new exp/log functions. */ fmpz_sub(e, e, MAG_EXPREF(x)); fmpz_cdiv_q_ui(e, e, n); fmpz_mul_ui(f, e, n);