bridge/class-master/depend/pari/src/basemath/gen2.c
/* returns 1 whenever the x = -1, 0 otherwise */
returns 1 whenever the x = -1, 0 otherwise
returns 1 whenever the x = - 1 0 otherwise
int
gequalm1(GEN x)
{
  pari_sp av;
  long y;
  GEN p1;
  switch(typ(x))
  {
    case t_INT:
      return equalim1(x);
    case t_REAL:
    {
      long s = signe(x);
      if (!s) return expo(x) >= 0;
      return s < 0 ? absrnz_equal1(x): 0;
    }
    case t_INTMOD:
      av=avma; y=equalii(addui(1,gel(x,2)), gel(x,1)); avma=av; return y;
    case t_FRAC:
      return 0;
    case t_FFELT:
      return FF_equalm1(x);
    case t_COMPLEX:
      return gequalm1(gel(x,1)) && gequal0(gel(x,2));
    case t_QUAD:
      return gequalm1(gel(x,2)) && gequal0(gel(x,3));
    case t_PADIC:
      av=avma; y=equalii(addui(1,gel(x,4)), gel(x,3)); avma=av; return y;
    case t_POLMOD:
      av=avma; p1 = gaddgs(gel(x,2), 1);
      y = gequal0(p1) || gequal(p1,gel(x,1)); avma=av; return y;
    case t_POL: return is_monomial_test(x, 0, &gequalm1);
    case t_SER: return is_monomial_test(x, valp(x), &gequalm1);
    case t_RFRAC:
      av=avma; y=gequal(gel(x,1), gneg_i(gel(x,2))); avma=av; return y;
    case t_COL: return col_test(x, &gequalm1);
    case t_MAT: return mat_test(x, &gequalm1);
  }
  return 0;
}
int gequalm1 ( GEN x ) { pari_sp av ; long y ; GEN p1 ; switch ( typ ( x ) ) { case t_INT : return equalim1 ( x ) ; case t_REAL : { long s = signe ( x ) ; if ( ! s ) return expo ( x ) >= 0 ; return s < 0 ? absrnz_equal1 ( x ) : 0 ; } case t_INTMOD : av = avma ; y = equalii ( addui ( 1 , gel ( x , 2 ) ) , gel ( x , 1 ) ) ; avma = av ; return y ; case t_FRAC : return 0 ; case t_FFELT : return FF_equalm1 ( x ) ; case t_COMPLEX : return gequalm1 ( gel ( x , 1 ) ) && gequal0 ( gel ( x , 2 ) ) ; case t_QUAD : return gequalm1 ( gel ( x , 2 ) ) && gequal0 ( gel ( x , 3 ) ) ; case t_PADIC : av = avma ; y = equalii ( addui ( 1 , gel ( x , 4 ) ) , gel ( x , 3 ) ) ; avma = av ; return y ; case t_POLMOD : av = avma ; p1 = gaddgs ( gel ( x , 2 ) , 1 ) ; y = gequal0 ( p1 ) || gequal ( p1 , gel ( x , 1 ) ) ; avma = av ; return y ; case t_POL : return is_monomial_test ( x , 0 , & gequalm1 ) ; case t_SER : return is_monomial_test ( x , valp ( x ) , & gequalm1 ) ; case t_RFRAC : av = avma ; y = gequal ( gel ( x , 1 ) , gneg_i ( gel ( x , 2 ) ) ) ; avma = av ; return y ; case t_COL : return col_test ( x , & gequalm1 ) ; case t_MAT : return mat_test ( x , & gequalm1 ) ; } return 0 ; }
returns 1 whenever the x = -1, 0 otherwise
returns 1 whenever the x = - 1 0 otherwise