bridge/class-master/depend/pari/src/language/es.c
/* if g is a "monomial", return its sign, 0 otherwise */
if g is a "monomial", return its sign, 0 otherwise
if g is a " monomial " return its sign 0 otherwise
static long
isfactor(GEN g)
{
  long i,deja,sig;
  switch(typ(g))
  {
    case t_INT: case t_REAL:
      return (signe(g)<0)? -1: 1;
    case t_FRAC: case t_RFRAC:
      return isfactor(gel(g,1));
    case t_FFELT:
      return isfactor(FF_to_FpXQ_i(g));
    case t_COMPLEX:
      if (isnull(gel(g,1))) return isfactor(gel(g,2));
      if (isnull(gel(g,2))) return isfactor(gel(g,1));
      return 0;
    case t_PADIC:
      return !signe(gel(g,4));
    case t_QUAD:
      if (isnull(gel(g,2))) return isfactor(gel(g,3));
      if (isnull(gel(g,3))) return isfactor(gel(g,2));
      return 0;
    case t_POL: deja = 0; sig = 1;
      for (i=lg(g)-1; i>1; i--)
        if (!isnull_for_pol(gel(g,i)))
        {
          if (deja) return 0;
          sig=isfactor(gel(g,i)); deja=1;
        }
      return sig? sig: 1;
    case t_SER:
      for (i=lg(g)-1; i>1; i--)
        if (!isnull(gel(g,i))) return 0;
  }
  return 1;
}
static long isfactor ( GEN g ) { long i , deja , sig ; switch ( typ ( g ) ) { case t_INT : case t_REAL : return ( signe ( g ) < 0 ) ? -1 : 1 ; case t_FRAC : case t_RFRAC : return isfactor ( gel ( g , 1 ) ) ; case t_FFELT : return isfactor ( FF_to_FpXQ_i ( g ) ) ; case t_COMPLEX : if ( isnull ( gel ( g , 1 ) ) ) return isfactor ( gel ( g , 2 ) ) ; if ( isnull ( gel ( g , 2 ) ) ) return isfactor ( gel ( g , 1 ) ) ; return 0 ; case t_PADIC : return ! signe ( gel ( g , 4 ) ) ; case t_QUAD : if ( isnull ( gel ( g , 2 ) ) ) return isfactor ( gel ( g , 3 ) ) ; if ( isnull ( gel ( g , 3 ) ) ) return isfactor ( gel ( g , 2 ) ) ; return 0 ; case t_POL : deja = 0 ; sig = 1 ; for ( i = lg ( g ) - 1 ; i > 1 ; i -- ) if ( ! isnull_for_pol ( gel ( g , i ) ) ) { if ( deja ) return 0 ; sig = isfactor ( gel ( g , i ) ) ; deja = 1 ; } return sig ? sig : 1 ; case t_SER : for ( i = lg ( g ) - 1 ; i > 1 ; i -- ) if ( ! isnull ( gel ( g , i ) ) ) return 0 ; } return 1 ; }
if g is a "monomial", return its sign, 0 otherwise
if g is a " monomial " return its sign 0 otherwise