bridge/class-master/depend/pari/src/basemath/dirichlet.c
/* return a t_SER or a truncated t_POL to precision n */
return a t_SER or a truncated t_POL to precision n
return a t_SER or a truncated t_POL to precision n
GEN
direuler_factor(GEN s, long n)
{
  long t = typ(s);
  if (is_scalar_t(t))
  {
    if (!gequal1(s)) err_direuler(s);
    return scalarpol_shallow(s,0);
  }
  switch(t)
  {
    case t_POL: break; 
    case t_RFRAC:
    {
      GEN p = gel(s,1), q = gel(s,2);
      q = RgXn_red_shallow(q,n);
      s = RgXn_inv(q, n);
      if (typ(p) == t_POL && varn(p) == varn(q))
      {
        p = RgXn_red_shallow(p, n);
        s = RgXn_mul(s, p, n);
      }
      else
        if (!gequal1(p)) s = RgX_Rg_mul(s, p);
      if (!signe(s) || !gequal1(gel(s,2))) err_direuler(s);
      break;
    }
    case t_SER:
      if (!signe(s) || valp(s) || !gequal1(gel(s,2))) err_direuler(s);
      break;
    default: pari_err_TYPE("direuler", s);
  }
  return s;
}
GEN direuler_factor ( GEN s , long n ) { long t = typ ( s ) ; if ( is_scalar_t ( t ) ) { if ( ! gequal1 ( s ) ) err_direuler ( s ) ; return scalarpol_shallow ( s , 0 ) ; } switch ( t ) { case t_POL : break ; case t_RFRAC : { GEN p = gel ( s , 1 ) , q = gel ( s , 2 ) ; q = RgXn_red_shallow ( q , n ) ; s = RgXn_inv ( q , n ) ; if ( typ ( p ) == t_POL && varn ( p ) == varn ( q ) ) { p = RgXn_red_shallow ( p , n ) ; s = RgXn_mul ( s , p , n ) ; } else if ( ! gequal1 ( p ) ) s = RgX_Rg_mul ( s , p ) ; if ( ! signe ( s ) || ! gequal1 ( gel ( s , 2 ) ) ) err_direuler ( s ) ; break ; } case t_SER : if ( ! signe ( s ) || valp ( s ) || ! gequal1 ( gel ( s , 2 ) ) ) err_direuler ( s ) ; break ; default : pari_err_TYPE ( " " , s ) ; } return s ; }
return a t_SER or a truncated t_POL to precision n
return a t_SER or a truncated t_POL to precision n
/* no need to RgXn_red */