mirror of
https://github.com/vale981/arb
synced 2025-03-05 09:21:38 -05:00
move mag_add_ui_lower; small cleanup
This commit is contained in:
parent
5f84e77a5b
commit
85abb2ba84
4 changed files with 12 additions and 9 deletions
|
@ -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
|
||||
|
|
1
mag.h
1
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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue