bridge/class-master/depend/pari/src/basemath/trans3.c
/* assume n even > 0. Faster than standard bernfrac for n >= 6 */
assume n even > 0. Faster than standard bernfrac for n >= 6
assume n even > 0 . Faster than standard bernfrac for n > = 6
GEN
bernfrac_using_zeta(long n)
{
  pari_sp av = avma;
  GEN iz, a, d, D = divisorsu(n >> 1);
  long i, prec, l = lg(D);
  double t, u;
  d = utoipos(6); 
  for (i = 2; i < l; i++) 
  { 
    ulong p = 2*D[i] + 1;
    if (uisprime(p)) d = muliu(d, p);
  }
  t = log(gtodouble(d)) + (n + 0.5) * log((double)n) - n*(1+log2PI) + 1.612086;
  u = t / M_LN2; prec = nbits2prec((long)ceil(u) + BITS_IN_LONG);
  iz = inv_szeta_euler(n, t, prec);
  a = roundr( mulir(d, bernreal_using_zeta(n, iz, prec)) );
  return gerepilecopy(av, mkfrac(a, d));
}
GEN bernfrac_using_zeta ( long n ) { pari_sp av = avma ; GEN iz , a , d , D = divisorsu ( n >> 1 ) ; long i , prec , l = lg ( D ) ; double t , u ; d = utoipos ( 6 ) ; for ( i = 2 ; i < l ; i ++ ) { ulong p = 2 * D [ i ] + 1 ; if ( uisprime ( p ) ) d = muliu ( d , p ) ; } t = log ( gtodouble ( d ) ) + ( n + 0.5 ) * log ( ( double ) n ) - n * ( 1 + log2PI ) + 1.612086 ; u = t / M_LN2 ; prec = nbits2prec ( ( long ) ceil ( u ) + BITS_IN_LONG ) ; iz = inv_szeta_euler ( n , t , prec ) ; a = roundr ( mulir ( d , bernreal_using_zeta ( n , iz , prec ) ) ) ; return gerepilecopy ( av , mkfrac ( a , d ) ) ; }
assume n even > 0.
assume n even > 0 .
/* 2 * 3 */ /* skip 1 */ /* Clausen - von Staudt */ /* 1.612086 ~ log(8Pi) / 2 */