mirror of
https://github.com/vale981/arb
synced 2025-03-06 01:41:39 -05:00
add mag_const_pi and improve the worst-case bound in arb_atan
This commit is contained in:
parent
ce58576143
commit
35c7c9b27b
3 changed files with 15 additions and 0 deletions
|
@ -334,6 +334,12 @@ arb_atan(arb_t z, const arb_t x, slong prec)
|
||||||
mag_div(t, arb_radref(x), t);
|
mag_div(t, arb_radref(x), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mag_cmp_2exp_si(t, 0) > 0)
|
||||||
|
{
|
||||||
|
mag_const_pi(u);
|
||||||
|
mag_min(t, t, u);
|
||||||
|
}
|
||||||
|
|
||||||
arb_atan_arf(z, arb_midref(x), prec);
|
arb_atan_arf(z, arb_midref(x), prec);
|
||||||
mag_add(arb_radref(z), arb_radref(z), t);
|
mag_add(arb_radref(z), arb_radref(z), t);
|
||||||
|
|
||||||
|
|
|
@ -334,6 +334,10 @@ Powers and logarithms
|
||||||
Special functions
|
Special functions
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.. function:: void mag_const_pi(mag_t z)
|
||||||
|
|
||||||
|
Sets *z* to an upper bound for `\pi`.
|
||||||
|
|
||||||
.. function:: void mag_fac_ui(mag_t z, ulong n)
|
.. function:: void mag_fac_ui(mag_t z, ulong n)
|
||||||
|
|
||||||
Sets *z* to an upper bound for `n!`.
|
Sets *z* to an upper bound for `n!`.
|
||||||
|
|
5
mag.h
5
mag.h
|
@ -697,6 +697,11 @@ mag_div_fmpz(mag_t z, const mag_t x, const fmpz_t y)
|
||||||
mag_clear(t);
|
mag_clear(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MAG_INLINE void mag_const_pi(mag_t res)
|
||||||
|
{
|
||||||
|
mag_set_ui_2exp_si(res, 843314857, -28);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue