mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
use table for const_euler at low prec
This commit is contained in:
parent
43a337041a
commit
9916182253
1 changed files with 28 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "arb.h"
|
||||
#include "hypgeom.h"
|
||||
#include "arb_hypgeom.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -333,5 +334,31 @@ arb_const_euler_eval(arb_t res, slong prec)
|
|||
euler_bsplit_clear(sum);
|
||||
}
|
||||
|
||||
ARB_DEF_CACHED_CONSTANT(arb_const_euler, arb_const_euler_eval)
|
||||
ARB_DEF_CACHED_CONSTANT(arb_const_euler_brent_mcmillan, arb_const_euler_eval)
|
||||
|
||||
extern const mp_limb_t arb_hypgeom_gamma_tab_limbs[];
|
||||
|
||||
void
|
||||
arb_const_euler(arb_t res, slong prec)
|
||||
{
|
||||
if (prec < ARB_HYPGEOM_GAMMA_TAB_PREC - 16)
|
||||
{
|
||||
slong exp;
|
||||
mp_size_t n;
|
||||
|
||||
n = ARB_HYPGEOM_GAMMA_TAB_PREC / FLINT_BITS;
|
||||
|
||||
/* just reading the table is known to give the correct rounding */
|
||||
_arf_set_round_mpn(arb_midref(res), &exp, arb_hypgeom_gamma_tab_limbs + n, n, 0, prec, ARF_RND_NEAR);
|
||||
_fmpz_set_si_small(ARF_EXPREF(arb_midref(res)), exp);
|
||||
|
||||
/* 1/2 ulp error */
|
||||
_fmpz_set_si_small(MAG_EXPREF(arb_radref(res)), exp - prec);
|
||||
MAG_MAN(arb_radref(res)) = MAG_ONE_HALF;
|
||||
}
|
||||
else
|
||||
{
|
||||
arb_const_euler_brent_mcmillan(res, prec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue